Database Design Example ORDER SYSTEM CUSTOMER 1 1

Database Design Example : ORDER SYSTEM CUSTOMER 1: 1 PLACES 0: M ORDER 1: M ORDERLINE 1: M CONTAINS 1: M PRODUCT

Customers c. First. Name c. Last. Name Primary Key 1: 1 c. Phone c. Street c. Zip. Code order. Date sold. By Orders 0: M Foreign Key c. First. Name c. Last. Name c. Phone Primary Key

Customers cust. ID c. First. Name c. Last. Name c. Phone PK Candidate Key (1 of 2) 1: 1 Orders 0: M FK cust. ID order. Date Primary Key sold. By c. Street c. Zip. Code

Customers cust. ID c. First. Name c. Last. Name c. Phone c. Street c. Zip. Code PK Candidate Key (1 of 2) 1: 1 Orders 0: M FK cust. ID order. Date sold. By Primary Key 1: 1 Order. Lines 1: M Foreign Key cust. ID order. Date UPC quantity unit. Sale. Price Primary Key FK Products 1: 1 0: M PK UPC prod. Name mfgr model unit. List. Price units. In. Stock Candidate Key (1 of 2)

Table (relation) name Customers c. Street Column (attribute) names c. First. Name c. Last. Name c. Phone Tom Jewett 714 -555 -1212 1020 Slater Row (tuples) c. Zip. Code 92708 Alvaro Monge 562 -333 -4141 2145 Main 90840 Wayne Dick 562 -777 -3030 1250 Bellfower 90840 Table (relation) name Orders order. Date Column (attribute) names c. First. Name c. Last. Name c. Phone Alvaro Monge 562 -333 -4141 2003 -07 -14 Row (tuples) sold. By Patrick Wayne Dick 562 -777 -3030 2003 -07 -14 Patrick Alvaro Monge 562 -333 -4141 2003 -07 -18 Kathleen

Customers cust. Id c. First. Name c. Last. Name c. Phone c. Street c. Zip. Code 1234 Tom Jewett 714 -555 -1212 1020 Slater 92708 5678 Alvaro Monge 562 -333 -4141 2145 Main 90840 9012 Wayne Dick 562 -777 -3030 1250 Bellfower 90840 Orders cust. Id order. Date sold. By 5678 2003 -07 -14 Patrick 9012 2003 -07 -14 Patrick 5678 2003 -07 -18 Kathleen

Order. Lines cust. ID order. Date UPC Products cust. ID order. Date 5678 51820 33622 UPC 5678 2003 -07 -14 9012 2003 -07 -14 33622 51820 33622 9012 2003 -07 -14 24793 11373 42877 34040 5678 2003 -07 -18 73555 81809 73555 5678 2003 -07 -20 33622 51820 11373 24793 5678 2003 -07 -20 73555 81809 81810 63591 Orders 2003 -07 -14 5678 2003 -07 -20 63591 81810
- Slides: 7