Home | Previous Page | Next Page   Appendix A. The stores_demo Database > Primary-Foreign Key Relationships >

The items and stock Tables

The items table and the stock table are joined by two columns: the stock_num column, which stores a stock number for an item, and the manu_code column, which stores a code that identifies the manufacturer. You need both the stock number and the manufacturer code to uniquely identify an item. For example, the item with the stock number 1 and the manufacturer code HRO is a Hero baseball glove; the item with the stock number 1 and the manufacturer code HSK is a Husky baseball glove.

The same stock number and manufacturer code can appear in more than one row of the items table, if the same item belongs to separate orders. In the items table, the stock_num and manu_code columns are foreign keys that reference the stock_num and manu_code columns in the stock table. Figure 9 shows this relationship.

Figure 9. Tables That the stock_num and manu_code Columns Join
begin figure description -- This figure shows data from portions of rows in the items table and in the stock table, where the stock_num and manu_code columns in the items table are foreign keys that reference the stock_num and manu_code columns in the stock table. -- end figure description
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]