• This is a question about table design raised because of this QoD.

    Re this part of the question:

    "CREATE TABLE [dbo].[OrderDetail](

    [OrderDetailID] [int] NOT NULL,

    [OrderID] [int] NULL,

    CONSTRAINT [PK_OrderDetail] PRIMARY KEY CLUSTERED

    ([OrderDetailID] ASC))"

    why would you allow what is going to be the foreign key (OrderID) to be NULL in the table definition? I'm assuming you would not want an OrderDetail record without an Order record so why is OrderID not defined as NOT NULL in the definition of OrderDetail? Or does the setting up of the FK constraint mean it doesn't actually matter?