Chapter 9 NORMALIZATION 1
Chapter 9 NORMALIZATION 1
Normalization
Sonik Shrestha
M.Sc Information System
NTNU, TRONDHEIM, NORWAY
ANOMALIES
• Types
– Update Anomalies
– Delete Anomalies and
– Insert Anomalies
Update anamoly
• Update Anomaly arises when there is duplication of data. So when data is
updated at one place, but not at another places, the database table is rendered
ambiguous. Consider the following Order table.
Delete Anamoly
• Delete Anomaly occurs when certain field information is lost due to deletion of
other fields.
Insert Anamoly
• Insert Anomaly is when we are unable to insert a piece of information unless
some other piece is also present .
FUNCTIONAL DEPENDENCIES
• A functional dependency occurs when one
attribute in a relation uniquely determines
another attribute. This can be written A -> B
which would be the same as stating :
– "B is functionally dependent upon A."
– “A functionally determines B.”
Contd..
A B C D
a1 b1 c1 d1
a1 b2 c1 d2
a2 b2 c2 d2
a2 b2 c2 d3
a3 b3 c2 d4
Db 20/05/2015 Database 8 4
After applying 2NF
Course_id Date Seats Room
Sql 25/08/2015 10 1
ASP 20/06/2015 12 2
Sql 20/07/2015 15 3
Db 20/05/2015 8 4
THIRD NORMAL FORM (3NF)
• Conditions for 3NF
– Should be in 2NF and
– No-non key fields are dependent on another non
key field
Contd…
Event_id Course_id Date Available Room Capacity
1 Sql 20/08/2015 5 14 30
2 Asp 20/07/2015 2 15 22
3 Sql 20/06/2015 4 12 18
4 Db 20/09/2014 6 10 20
• Primary Key – Event_id
• Capacity is dependent on Room
3NF contd…
• So, to convert it to 3NF form
Event_id Course_id Date Available Room
1 Sql 20/08/2015 5 14
2 Asp 20/07/2015 2 15
3 Sql 20/06/2015 4 12
4 Db 20/09/2014 6 10
Room Capacity
14 30
15 22
12 18
10 20
One more example
1 P1 2 6 12
2 P2 3 5 115
3 P3 4 4 16
4 P4 5 3 15
–OR
– If a Relation(table) R has multi-valued dependencies (X->-
>Y), then multi-valued dependency should be trivial or X is
a super key for relation R.
• So What is Multi valued Dependencies (MVD)
Multi Value Dependency
• Remember 1NF form
Emp_name Project_name Dependent_name
Hari X Krishna
Hari Y Radha
Hari X Radhan
Hari Y Krishna
Emp_name:Project_name (1:N)
Emp_name:Dependent_name (1:N)
Emp_nameProject_name
Emp_nameDependent_name
MVD contd..
• Types of Multi Value Dependency
– Trivial
• If XY, (Y is subset of X)
• And (XuY=R)
• Else NON-Trivial
4NF Example
Employee_name Project_name
Smith X
Smith Y
Employee_name Dependent_name
Smith Krishna
Smith Radha
• The table still contains redundant data. So, lets try decomposing this table
Contd..
• The Redundancy is minimized as much as possible.