DONUT ORDER ID
DONUT ID DONUT ORDER DONUT ID (PK)
Highlighted fields will form a Composite primary ID(PK)
DATE DONUT NAME
key. City State ID
CUSTOMER and Zip were separated DATE
DONUT DESCRIPTION
LAST NAME CUSTOMER ID
And are now atomic UNIT PRICE
FIRST NAME LAST NAME
STREET ADDRESS FIRST NAME
CITY STREET ADDRESS DONUT ORDER ID (PK)
STATE APT (FK)
ZIP CODE CITY QUANTITY
HOME PHONE STATE DONUT ID (PK)(FK)
MOBILE PHONE ZIP CODE
OTHER PHONE HOME PHONE
DESCRIPTION MOBILE PHONE
QTY OTHER PHONE
UNIT PRICE NOTES
NOTES No duplicate data, each of the above tables has a Primary Key, and a key
DONUT NAME (foreign) that can refer to another table in the group.
3NF
CUSTOMER ID (PK)
DATE
LAST NAME
CUSTOMER ID (FK)
FIRST NAME
NOTES DONUT ORDER ID
STREET ADDRESS
DONUT ORDER ID (PK)(FK)
APT
(PK) QUANTITY
CITY No transitive
of Keys. DONUTdependency.
ID (PK)(FK) New table has 2 the PKs from the other
STATE DONUT ID (PK) tables as Foreign
ZIP CODE DONUT NAME
HOME PHONE Each table has a primary key which can refer to another one of the
DONUT
MOBILE PHONE DESCRIPTION tables in this group.
OTHER PHONE UNIT PRICE
ORDER TABLE
DATE DATETIME
1:M DONUT TABLE DONUT_ID INT (pk)
DONUT_NAME VARCHAR (100)
CUSTOMERID
One Customer can place many OrdDONUT_DESCRIPTION INT (fk)
VARCHAR (255)
ER DIAGRAM Customer table has single pk UNIT_PRICE DECIMAL
DONUT_ORDER_ID
(10,2) INT (pk)
ers
QUNOATENSTIVTYARTCAHBLA
ER (255)
QUANTITY INT
DONUT_ORDER_ID INT (pk) (fk)
DONUT_ID INT (pk)(fk)
, One order can have
many different quantities
1:M
CUSTOMER TABLE
CUSTOMER_ID INT (pk)
LAST_NAME VARCHAR
(30)
FIRST_NAME VARCHAR (30)
STREET_ADDRESS VARCHAR (100)
APT INT,
CITY VARCHAR (30)
STATE VARCHAR (30)
ZIP_CODE INT
HOME_PHONE VARCHAR (20) One donut order can hold
MOBILE_PHONE VARCHAR (20) many different quantities
of donut types of donut types
OTHER_PHONE VARCHAR (20)
1:M
create table
customers( customer_i
d INT,