4 - Normalization
4 - Normalization
Definitions
• A process of analyzing a relation to ensure that it is well formed
◦ Update Anomaly - exists when one or more instances of duplicated data is updated,
but not all
◦ Deletion Anomaly - exists when certain attributes are lost because of the deletion of
other attributes
Insertion Anomaly
customerId customerName carId year make model
1 Mischka Sophia 102 2003 Volkswagen Golf
Customer
customerId carId year make model price
Name
Mischka
1 102 2014 Mitsubishi Mirage 900K
Sophia
Kenra
2 101 2014 Toyota Prius 2M
Elienette
Thea
3 103 2010 Nissan Sentra 900K
Pauline
4 Ruel Paolo 102 2014 Mitsubishi Mirage 900K
James
5 104 2016 Honda Civic 1.2M
Aaron
Eunice
6 102 2014 Mitsubishi Mirage 900K
Czarina
Customer
customerId carId carId year make model price
Name
Mischka 102 2014 Mitsubishi Mirage 900K
1 102
Sophia
Kenra 101 2014 Toyota Prius 2M
2 101
Elienette
Thea 103 2010 Nissan Sentra 900K
3 103
Pauline
4 Ruel Paolo 102 102 2014 Mitsubishi Mirage 900K
Hanae
1 Osaka D01 D01 Accounting Valdez
Yoshimori
Donald
6 Mumbai D01 D01 Accounting Valdez
McElhenny
Definitions
Functional dependency
You can also describe this as a relationship where knowing the
value of one attribute (or a set of attributes) is enough to tell you
the value of another attribute (or set of attributes) in the same
table.
Examples:
SSS No. -> Employee’s Name, Employee’s contributions …
Bank Account No. -> Customer Name, Amount of Deposit…
Partial functional dependency – when a non-key attribute is
functionally dependent on part (but not all) of the primary key
Flight NoOf
FlightDate From To
Number Passengers
1750 Kuala
UA 36 3-Sep-16 1410 Manila 200
Lumpur
0455 Kuala
AA 704 31-Oct-16 0120 Manila 150
Lumpur
1750 Kuala
UA 36 4-Sep-16 1410 Manila 190
Lumpur
0435 Kuala
BA 9 31-Oct-16 0100 Manila 100
Lumpur
Transitive dependency – a functional dependency between the
primary key and one or more nonkey attributes that are
dependent on the primary key via another nonkey attribute
A B C
Transitive dependency – a functional dependency between the
primary key and one or more nonkey attributes that are
dependent on the primary key via another nonkey attribute
Customer ID : 22
Customer Name : Dan’s Furniture
Customer Address : Fullerton, California
Customer ID : 65
Customer Name : Furniture Barn
Customer Address : Fort Collins, Colorado
Order Order Cust ID Cust Cust Prod Product Prod Unit Ordered
ID Date Name Address ID Descriptio Finish Price Qty
n
Order Order Cust Customer Customer Prod Product Product Unit Ordered
ID Date ID Name Address ID Description Finish Price Qty
Product Product
Product ID Unit Price
Description Finish
Ordered
Order ID Product ID
Quantity
Going to the 3rd Normal Form
Transitive Dependencies
Product Product
Product ID Unit Price
Description Finish
Ordered
Order ID Product ID
Quantity
Third Normal Form
2NF PLUS No transitive dependencies
OrderT
Product Product
Product ID Unit Price Product
Description Finish
Ordered
Order ID Product ID Order_Detail
Quantity
Customer
Third Normal Form
2NF PLUS No transitive dependencies
OrderT
Product Product
Product ID Unit Price Product
Description Finish
Ordered
Order ID Product ID Order_Detail
Quantity
Customer
Dependency Diagram Full Dependency
Transitive Dependencies
Order Order Cust Customer Customer Prod Product Product Unit Ordered
ID Date ID Name Address ID Description Finish Price Qty
Order Order Cust ID Cust Cust Prod Product Prod Unit Ordered
ID Date Name Address ID Descriptio Finish Price Qty
n
Order Order Cust Customer Customer Prod Product Prod Unit Ordere
ID Date ID Name Address ID Description Finish Price d Qty
1006 24 Oct 22 Dan’s Fullerton, 7 Tea Table Walnut $450 2
2019 Furniture CA
1006 24 Oct 22 Dan’s Fullerton, 5 TV Stand Oak $300 6
2019 Furniture CA
1006 24 Oct 22 Dan’s Fullerton, 4 Porch Swing Pine $800 5
2019 Furniture CA
1007 31 Oct 65 Furniture Ft. 11 Table Cherry $1150 3
2019 Barn Collin,Co
1007 31 Oct 65 Furniture Ft. 4 Porch Swing Pine $800 7
2019 Barn Collin,Co
3NF
OrderT(orderID, orderdate,custid)
Product(prodid, proddesc,finish,
uprice)
OrderT
Order_detail(orderID, prodid, qty)
Ordered
Order ID Product ID Order_Detail
Quantity
Customer
Source