






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







CUSTOMERID INT (fk)
DONUT_ORDER_ID INT (pk)
ers
DONUT_ORDER_ID INT (pk) (fk)
DONUT_ID INT (pk)(fk)
Highlighted fields will form a
Composite primary key. City
State and Zip were separated
And are now atomic
No duplicate data, each of the above tables has a Primary Key, and a key
(foreign) that can refer to another table in the group.
No
of
Keys.
transitive dependency. New table has 2
the PKs from the other tables as Foreign
Each table has a primary key which can refer to another one of the
tables in this group.
One Customer can place many Ord
Customer table has single pk
DONUT_ID INT (pk)
CUSTOMER_ID INT (pk)
One order can have many
different quantities
of donut types
One donut order can hold
many different quantities
of donut types
create table customers(
customer_id INT,
orderdate date,
customer_id int,
notes varchar (255)
primary key (donut_order_id)
create table donuts(
donut_id int,
donut_name varchar(100),
donut_description varchar (255),
unit_price decimal (10,2),
primary key (donut_id)
create table qty(
quantity int,
donut_order_id int,
donut_id int,
primary key (donut_order_id, donut_id)
create view customerdata as
select
concat(first_name,’ ‘,last_name) as customername,
street_address,apt,city,state,zip_code,
home_phone,mobile_phone,other_phone
from customers
insert into orders (
donut_order_id,customer_id,orderdate,notes)
values
('1','1',’2017- 12 - 14’,’plates and napkins requested’);
insert into donuts
donut_name,donut_description,unit_price,donut_id
values
('Plain','Plain Donut','1.50',’1’)
insert into qty
(quantity,donut_order_id,donut_id)
values