previous | index | next

Compound Keys

The sales_order table does not contain a column with item information because the number of kinds of items in an order is variable.

To deal with this, we create an Order Item Table that lists individual items and the orders in which they appear.

Note that an order item is uniquely identified by the combination of its order ID and item ID, so those fields are not only foreign keys but also a compound key.

Note also that the primary key constraint here is a table-level, rather than column-level, constraint.


previous | index | next