Normalization 2
Normalization 2
Normalisation
Part – 2
The Process of Normalization
• Formal technique for analyzing a relation based on its
primary key and functional dependencies between its
attributes.
• Often executed as a series of steps. Each step
corresponds to a specific normal form, which has
known properties.
• As normalization proceeds, relations become
progressively more restricted (stronger) in format and
also less vulnerable to update anomalies.
Relationship between the normal forms
Purchase Order - Attribute Analysis
ATTRIBUTE TYPE LEN- DESCRIPTION
GTH
PO-NO N 3 Unique purchase order (PO) number.
Many parts can be ordered in one PO
PO-DATE D 8 DDMMYYYY date when PO written
EMP-CODE C 2 Unique code of employee who wrote
the PO
SUPP-NO N 3 Unique number assigned to supplier
SUPP-NAME C 20 Supplier name
PART-NO N 2 Unique number assigned to each part
PART-DESC C 10 Part description
PART-QTY N 2 Quantity of parts ordered in given PO
Key PO-NO
Purchase Order Relation in 0NF
PO PO-PART
PO- PO- EMP- SUP SUPP- PO- PAR PART- PART
NO DATE CODE P-NO NAME NO T-NO DESC -QTY
111 01012001 M2 222 AC Stores 111 P1 Nut 10
112 01012001 S3 105 I Hardware 111 P2 Bolt 5
113 02012001 S1 111 BC Trading 111 P3 Nail 3
114 02012001 M2 150 DO Service 111 P5 Screw 6
115 03012001 S1 222 AC Stores 112 P2 Bolt 2
116 04012001 S1 100 LM Centre 112 P5 Screw 1
113 P1 Nut 3
113 P3 Nail 4
114 P6 Plug 5
115 P7 Pin 8
116 P8 Fuse 2
Problems - 1NF
1.INSERT PROBLEM
do not know available parts until an order is placed
(e.g. P4 is bush)
2. DELETE PROBLEM
loose information of part P7 if we cancel purchase
order 115 (i.e. Delete PO-PART for Part No P7)
3. UPDATE PROBLEM:
to change description of Part P3 we need to change
every tuple in PO-PART containing Part No P3
Second Normal Form - 2NF
• Emp_Proj
PO
SUPPLIER
PO- PO-DATE EMP- SUP
NO CODE P-NO SUP SUPP-
P-NO NAME
111 01012001 M2 222
112 01012001 S3 105 100 LM Centre
113 02012001 S1 111 105 I Hardware
114 02012001 M2 150 111 BC Trading
115 03012001 S1 222 150 DO Service
116 04012001 S1 100 222 AC Stores
Purchase Order Relations in 3NF
SUPPLIER SUP SUPP-
P-NO NAME
PART PO-PART
222 AC Stores
105 I Hardware PAR PART- PO- PAR PART
111 BC Trading T-NO DESC NO T-NO -QTY
150 DO Service P1 Nut 111 P1 10
222 AC Stores P2 Bolt 111 P2 5
100 LM Centre P3 Nail 111 P3 3
PO P5 Screw 111 P5 6
PO- PO- EMP- SUP P6 Plug 112 P2 2
NO DATE CODE P-NO P7 Pin 112 P5 1
111 01012001 M2 222 P8 Fuse 113 P1 3
112 01012001 S3 105 113 P3 4
113 02012001 S1 111 114 P6 5
114 02012001 M2 150 115 P7 8
115 03012001 S1 222 116 P8 2
116 04012001 S1 100
Further Normalization
• BCNF or Boyce–Codd Normal form
• 4th Normal form
• 5th Normal form
In a normal situation normalization up-to 3NF is quite
sufficient. Certain relations may even be de-
normalized on account of efficiency. The
Normalizations which are discussed next are not
practically enforced most of the time.
• But a relation in 3NF does not guarantee that all
anomalies have been removed, hence the additional
normalizations.
Boyce Codd Normal Form
Instructor Student
Definition of Third and Boyce-Codd
Normal Form
3NF
• A relation schema R is in third normal form
(3NF) if, whenever a nontrivial functional
dependency XÆ A holds in R, either
(a) X is a superkey of R or
(b) A is a prime attribute of R
BCNF
• A relation schema R is in BCNF if whenever a
nontrivial functional dependency XÆ A holds
in R, then X is superkey of R