Database Reference
In-Depth Information
Table B.4 orders Table Columns
Column
Description
order_num
Unique order number
order_date
Order date
cust_id
Order customer ID (relates to cust_id in customers table)
All tables should have primary keys defined. This table should use
order_num as its primary key. order_num is an auto increment field.
To enforce referential integrity, a foreign key should be defined on
cust_id , relating it to cust_id in customers .
The orderitems Table
The orderitems table
(see Table B.5) stores the actual items in each order, one
row per item per order. For every row in orders there are one or more rows
in orderitems . Each order item is uniquely identified by the order number plus
the order item (first item in order, second item in order, and so on). Order
items are associated with their appropriate order by the order_num column
(which relates to the order's unique ID in orders ). In addition, each order item
contains the product ID of the item orders (which relates the item back to the
products table).
Table B.5 orderitems Table Columns
Column
Description
order_num
Order number (relates to order_num in orders table)
order_item
Order item number (sequential within an order)
prod_id
Product ID (relates to prod_id in products table)
quantity
Item quantity
item_price
Item price
All tables should have primary keys defined. This table should use
order_num and order_item as its primary keys.
To enforce referential integrity, foreign keys should be defined on
order_num , relating it to order_num in orders , and prod_id , relating it
to prod_id in products .
 
 
Search WWH ::




Custom Search