N northstar May 7, 2008 #1 Can someone please give me a couple of examples of a table with a multiple-field primary key? When would this concept be used?
Can someone please give me a couple of examples of a table with a multiple-field primary key? When would this concept be used?
R Rick Brandt May 7, 2008 #2 northstar said: Can someone please give me a couple of examples of a table with a multiple-field primary key? When would this concept be used? Click to expand... EX_1: Two tables: Orders: PK = OrderNumber OrderLineItems: PK = OrderNumber; LineNumber Or where some companies only allow an Item to be listed once on an order.... Orders: PK = OrderNumber OrderLineItems: PK = OrderNumber; ItemID EX_2: Two tables: Customers: PK = CustomerID CustomerEmail: PK = CustomerID; EMailAddress These are more common in cases where the db admin uses natural keys instead of numeric surrogate keys. EX_3: One Table: Inspections: PK = Warehouse; PartNumber; PONumber; InspectDateTime
northstar said: Can someone please give me a couple of examples of a table with a multiple-field primary key? When would this concept be used? Click to expand... EX_1: Two tables: Orders: PK = OrderNumber OrderLineItems: PK = OrderNumber; LineNumber Or where some companies only allow an Item to be listed once on an order.... Orders: PK = OrderNumber OrderLineItems: PK = OrderNumber; ItemID EX_2: Two tables: Customers: PK = CustomerID CustomerEmail: PK = CustomerID; EMailAddress These are more common in cases where the db admin uses natural keys instead of numeric surrogate keys. EX_3: One Table: Inspections: PK = Warehouse; PartNumber; PONumber; InspectDateTime