Database Reference
In-Depth Information
What follows is a description of each of the six tables, along with the name of
the columns within each table and their descriptions.
Note
Why Out of Order? If you are wondering why the six tables are listed in the order they
are, it is due to their dependencies. As the
products
tables is dependent on the
vendors
table,
vendors
is listed first, and so on.
The
vendors
Table
The
vendors
table (see Table B.1) stores the vendors whose products are sold.
Every vendor has a record in this table, and that vendor ID (the
vend_id
) col-
umn is used to match products with vendors.
Table B.1
vendors
Table Columns
vend_id
Unique numeric vendor ID
vend_name
Vendor name
vend_address
Vendor address
vend_city
Vendor city
vend_state
Vendor state
vend_zip
Vendor Zip Code
vend_country
Vendor country
■
All tables should have primary keys defined. This table should use
vend_id
as its primary key.
vend_id
is an auto increment field.
The
products
Table
The
products
table
(see Table B.2) contains the product catalog, one product
per row. Each product has a unique ID (the
prod_id
column) and is related to
its vendor by
vend_id
(the vendor's unique ID).