






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The process of database normalization, specifically focusing on 1nf, 2nf, and 3nf, using a donut order system as an example. It includes er diagrams, table structures, and sql queries for creating tables, inserting data, and retrieving information. The document also demonstrates how to create views and indexes to optimize database performance. It is useful for understanding database design principles and sql syntax in a practical context, providing a hands-on approach to learning database management.
Typology: Exams
1 / 10
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