0% found this document useful (0 votes)
14 views

Normalization

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Normalization

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

DATABASE

MANAGEMENT

SYSTEM
Contents
Need of Normalization

Types of Normalization

How we can find the highest normal form of a


relation?
DATA NORMALIZATION
 Primarily a tool to validate and improve
a logical design so that it satisfies
certain constraints that avoid
unnecessary duplication of
data.
 The process of decomposing relations
with anomalies to produce smaller,
well-structured relations.
WELL-STRUCTURED
RELATIONS
 A relation that contains minimal data redundancy
and allows users to insert, delete, and update
rows without causing data inconsistencies
 Goal is to avoid anomalies
 Insertion Anomaly–adding new rows forces user to
create duplicate data.
 Deletion Anomaly–deleting rows may cause a loss of
data that would be needed for other future rows.
 Modification Anomaly–changing data in a row forces
changes to other rows because of duplication.

General rule of thumb: A table should not pertain to


more than one entity type
STUDENT
RN Nam Ag B_ID B_Name HOD Ph.
e e
1 A 20 101 CS XYZ 123
2 B 21 101 CS XYZ 123
3 C 18 102 IT PQR 456
4 D 20 102 IT PQR 456
5 E 22 101 CS XYZ 123

• Insertion Anomaly
• Updation Anomaly
• Deletion Anomaly
STUDENT BRANCH
RN Nam Ag B_ID B_ID B_Nam HOD Ph.
e e e
1 A 20 101 101 CS XYZ 123
2 B 21 101 102 IT PQR 456
3 C 18 102
4 D 20 102
5 E 22 101

• Insertion Anomaly
• Updation Anomaly
• Deletion Anomaly
Steps in normalization
FIRST NORMAL FORM
 No multivalued attributes
 Every attribute value is atomic
 Fig. 5-25 is not in 1st Normal Form
(multivalued attributes)  it is not a
relation
 Fig. 5-26 is in 1st Normal form
 All relations are in 1st Normal Form
Table with multivalued attributes, not in 1st normal form
Table with no multivalued attributes and unique rows, in 1st
normal form

Note: this is relation, but not a well-structured one


ANOMALIES IN THIS TABLE
 Insertion–if new product is ordered for order
1007 of existing customer, customer data
must be re-entered, causing duplication
 Deletion–if we delete the Dining Table from
Order 1006, we lose information concerning
this item's finish and price
 Update–changing the price of product ID 4
requires update in several records
Why do these anomalies exist?
Because there are multiple themes (entity types) in one
relation. This results in duplication and an unnecessary
dependency between the entities
SECOND NORMAL FORM
 1NF PLUS every non-key
attribute is fully functionally
dependent on the ENTIRE
primary key
 Every non-key attribute must be
defined by the entire key, not by only
part of the key
 No partial functional dependencies
Figure : Functional dependency diagram for INVOICE

Order_ID  Order_Date, Customer_ID, Customer_Name, Customer_Address


Customer_ID  Customer_Name, Customer_Address
Product_ID  Product_Description, Product_Finish, Unit_Price
Order_ID, Product_ID  Order_Quantity

Therefore, NOT in 2nd Normal Form


Figure: Removing partial dependencies

Getting it into Second


Normal Form

Partial dependencies are removed, but there


are still transitive dependencies
THIRD NORMAL FORM
 2NF PLUS no transitive dependencies
(functional dependencies on non-primary-key
attributes)
 Note: This is called transitive, because the
primary key is a determinant for another
attribute, which in turn is a determinant for a
third
 Solution: Non-key determinant with transitive
dependencies go into a new table; non-key
determinant becomes primary key in the new
table and stays as foreign key in the old table
Figure: Removing partial dependencies

Getting it into Third


Normal Form

Transitive dependencies are removed


SUMMARY

   

Prime Non-Prime
   

Non-Prime Non-Prime
  

N/P Prime
 A relation is said to be in 2nd normal form if it is in 1st
normal form and there is no partial functional
dependency in any of the functional dependency.

 A relation is said to be in 3rd normal form if every


functional dependency holds either of following condition:
 Left side is a super key.
OR
 Right side is a prime attribute.

 A relation is said to be in BCNF or 3.5 normal form if for


every functional dependency, the left side is a super key.
FIND THE HIGHEST NORMAL FORM
 Consider the relation R ( A, B, C, D, E ) and following
function dependency:-
BCNF X
CE  D C. K.= { CE } 3NF X
DB 2NF X
1NF 
CA
 Consider the relation R ( A, B, C, D, E ) and following

function dependency:-
AB  CD C. K.= {AB, BD, BC} BCNF X
3NF 
DA
BC  DE
FIND THE HIGHEST NORMAL FORM
Consider the relation R ( A, B, C ) and following function
dependency:-
AB C. K.= { A, B, C } BCNF 

BC
CA
 Consider the relation R ( A, B, C, D, E, F, G, H, I ) and

following function dependency:-


BCNF X
AB  C C. K.= {ABD} 3NF X
BD  EF 2NF X
1NF 
AD  GH
A I
EXAMPLE OF BCNF
 Consider the relation Patient_Detail ( P_No, P_Name,
App_No,Time, Doctor) and following function
dependency:- C. K.= {(P_No, app_No) , (P_No, Time) }
P_No  P_Name
P_No, App_No  Time, Doctor
Time  App_No
Now covert
PFDthis relation to BCNF.

P_No P_Name App_No Time Doctor

FFD
EXAMPLE OF BCNF
 T1 ( P_No, App_No, Time, Doctor) 3 NF

BCNF
 T2 ( P_No, P_Name)

PFD

P_No P_Name App_No Time Doctor

FFD
EXAMPLE OF BCNF
 T1 ( P_No, Time, Doctor) BCNF

 T2 ( P_No, P_Name)
BCNF

BCNF
 T3 (Time, App_No)

PFD

P_No P_Name App_No Time Doctor

FFD
THANKS

You might also like