Professional Documents
Culture Documents
(CSE 220)
Vikas Bajpai
Normalization:
• Set of rules to allocate data to tables.
• Purpose of Normalization:
– To minimize the redundancy.
– To minimize anomalies* related to insert, delete
and update of data.
– improve storage efficiency, data integrity, and
scalability
Normalization:
• In the relational model, methods exist for
quantifying how efficient a database is.
• These classifications are called normal forms
(or NF), and there are algorithms for
converting a given database between them.
• Normalization generally involves splitting
existing tables into multiple ones, which must
be re-joined or linked each time a query is
issued.
Normalization:
• In simple words:
– Normalization is a process of decomposing
unsatisfactory "bad" relations by breaking up their
attributes into smaller relations.
• The objective of normalization:
– To create relations where every dependency is on
the key, the whole key, and nothing but the key.
Insertion anomaly:
Also,
any relation that is in BCNF, is in 3NF;
any relation in 3NF is in 2NF; and
any relation in 2NF is in 1NF.
*We consider a relation in BCNF to be fully normalized.
Normalization:
EmpLname
EmpNum EmpEmail
•Attribute on the LHS is known as the
determinant
•EmpNum is a determinant of EmpEmail
Two types of Functional Dependencies:
1. Transitive dependency
2. Partial dependency
1. Transitive dependency
• Consider attributes A, B, and C, and where
A B and B C.
• Functional dependencies are transitive, which
means that we also have the functional
dependency AC
• We say that C is transitively dependent on A
through B.
Transitive dependency :Example
EmpNum DeptNum
DeptNum DeptName
Table 1
Title Author1 Author2 ISBN Subject Pages Publisher
Table 1
Title Author1 Author2 ISBN Subject Pages Publisher
Subject_ID Subject
1 MySQL
2 Computers
Author Table
Book Table
Book_Author Table
Book_Subject Table
ISBN Author_ID
0072958863 1
ISBN Subject_ID
0072958863 2
0072958863 1
0471694665 1
0072958863 2
0471694665 2
0471694665 2
Example for Practice
Product_ID Product_Color Price
101 Black, Brown $20
102 Yellow $40
103 Red $50
104 Pink, Violet $60
105 White $30
First Normal Table:
Product_Price Product_ID_Color
Product_ID Product_Color
101 Black
Product_ID Price
101 $20 101 Brown
102 $40 102 Yellow
103 $50
103 Red
104 $60
104 Pink
105 $30
104 Violet
105 White
Second Normal Form:
• As the First Normal Form deals with redundancy of
data across a horizontal row, Second Normal Form
(or 2NF) deals with redundancy of data in vertical
columns.
Item Color
T-shirt Red
T-shirt Blue Item Price Tax
Sweatshirt Black
Example for Practice