Professional Documents
Culture Documents
Normalization
Normalization
Table in 1NF
19
Partial dependencies in ORDER?
ORDER(Order_ID, Order_Date, Customer_ID, Custome_Name,
Customer_City, Customer_State, Product_ID, Product_Description,
Product_ID ➔ Product_Description,
Product_Finish, Unit_Price
20
Partial dependencies in ORDER?
21
Partial dependencies in ORDER?
25
Third Normal Form (3NF)
Customer(Customer_ID,
Customer_Name, Customer_Address)
28
Problems with Incorrect Decomposition
Decomposition must take place according to
that described for 3NF
Update Anomalies
Update, additions, deletions
Occur because of multivalued dependencies
4NF Table
In3NF and has no multivalued dependencies (we
will not do much of this)
Summary: Normal Forms
Summary
Normalization is a process of optimizing
databases to prevent update anomalies
Normalization attempts to correct update
issues by eliminating duplication
Duplication also creates inconsistency
Insertions can violate database integrity if the
database is not normalized
Deletions can violate database integrity if the
database is not normalized
Summary (con’t.)
Normal Forms – First (1NF), Second (2NF),
Third(3NF), and Fourth(4NF)
1NF has no repeating groups
2NF is in 1NF and no non-key field is dependent
on only a portion of the primary key
3NF is in 2NF and the only determinants are
candidate keys
Normalization Practice
A Normalization Practice
Consider the following table structure holding
The fields are described below:
all information about products (developed by
someone who didn’t know as much about ProdID Unique product ID number
database design as you do): CatID Unique product category ID number
PRODUCT (ProdID, CatID, SupplierID, Color, SupplierID Unique supplier ID number
Qty, Price, Name, Desc, Loc) Color Color of the product (red, yellow, etc.)
Consider the following business rules related Qty Number of units of the product in inventory
to this table: Price The price for each unit of the product
Name Company name of the supplier
Each product is supplied by a single supplier, but
each supplier may provide multiple products. Desc Description of each product category
Loc Warehouse location for each category of product
Each product is classified into a single product
category, but each product category may include
multiple products
Each product is in only one warehouse location,
but a location will house multiple products.
Answer the following questions
Answers
Questions
1. Is the table a relation (in 1NF)? How do 1. Is the table a relation (in 1NF)? How do you know? If not,
you know? If not, resolve. resolve.
2. Is the original/corrected relation in 2NF? Yes, it is in 1NF. It (presumably) has unique field names,
How do you know? unique rows, no composite or multi-valued fields, and no
ordered rows or columns.
If not 2NF, diagram only relevant
dependencies and resolve to new 2NF 2. Is the original/corrected relation in 2NF?
relations. DO NOT jump ahead to 3NF!
Yes, it is in 2NF, because it has a simple PK.
3. Are the relations created in #2 already in
3NF? 3. Are the relations created in #2 already in 3NF?
Questions Answers
1. Is the table a relation (in 1NF)? 1. Is the table a relation (in 1NF)? How do you
How do you know? If not, resolve. know? If not, resolve.
DO NOT jump ahead to 2NF! NO, it is NOT in 1NF. It has unique field
names, unique rows and no ordered rows or
columns. However, it has multi-valued
fields,.
Convert to 1NF
ITEM(Item_No, Description)
VENDOR(Vendor, Vendor_City)
COST(Item_No (FK), Vendor (FK), Item_Cost)
Convert to 3NF
Questions Answer
3. Are the 2NF relations created 3. Yes all 2NF relations are also
already in 3NF? in 3NF, because all tables only
How do you know?
have one non-key field, so there
are no transitive dependencies.
If not 3NF, diagram only relevant
dependencies and resolve to new
3NF relations.