Fundamentals of Database Systems: (Normalization - II)
Fundamentals of Database Systems: (Normalization - II)
Malay Bhattacharyya
Assistant Professor
The domain (or value set) of an attribute defines the set of values
it might contain.
Company Make
Company Make
Maruti WagonR, Ertiga
Maruti WagonR, Ertiga
Honda City
Honda City
Tesla RAV4
Tesla, Toyota RAV4
Toyota RAV4
BMW X1
BMW X1
Only Company has atomic domain None of the attributes have atomic domains
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Functional dependency
Functional dependency
t1[X ] = t2[X ],
in any legal relation r (R), for all pairs of tuples t1 and t2 in r , then
t1[Y ] = t2[Y ].
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
A B C A B C
1 1 2 1 1 2
1 2 2 1 1 2
2 3 1 2 3 1
3 3 1 3 3 1
AB is a superkey AB is not a superkey
AB → C holds AB → C holds
A B C
1 1 2
NOT POSSIBLE 1 1 2
2 3 1
3 3 1
AB is a superkey AB is not a superkey
AB → C does not hold AB → C does not hold
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Partial dependency
Functional dependency
Armstrong’s axioms:
Reflexivity property: If X is a set of attributes and Y ⊆ X ,
then X → Y holds. (known as trivial functional dependency)
Augmentation property: If X → Y holds and γ is a set of
attributes, then γX → γY holds.
Transitivity property: If both X → Y and Y → Z holds,
then X → Z holds.
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Functional dependency
Armstrong’s axioms:
Reflexivity property: If X is a set of attributes and Y ⊆ X ,
then X → Y holds. (known as trivial functional dependency)
Augmentation property: If X → Y holds and γ is a set of
attributes, then γX → γY holds.
Transitivity property: If both X → Y and Y → Z holds,
then X → Z holds.
Other properties:
Union property: If X → Y holds and X → Z holds, then
X → YZ holds.
Decomposition property: If X → YZ holds, then both
X → Y and X → Z holds.
Pseudotransitivity property: If X → Y and γY → Z holds,
then X γ → Z holds.
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Initialize F + with F
repeat
for each functional dependency f = X → Y ∈ F + do
Apply reflexivity and augmentation properties on f and
include the resulting functional dependencies in F +
end for
for each pair of functional dependencies f1 , f2 ∈ F + do
if f1 and f2 can be combined together using the transitivity
property then
Include the resulting functional dependency in F +
end if
end for
until F + does not further change
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Initialize A+ with A
repeat
for each functional dependency f = X → Y ∈ F + do
if X ⊆ A+ then
A+ ← A+ ∪ Y
end if
end for
until A+ does not further change
Initially UX+ = UX
Then we have UX+ = UVX (as U → V and U ⊆ UX)
Then we have UX+ = UVWX (as U → W and U ⊆ UVX)
Then we have UX+ = UVWXY (as WX → Y and WX ⊆
UVWX)
Finally, we have UX+ = UVWXYZ (as WX → Z and WX ⊆
UVWXY)
Decomposition of a relation
Decomposition criteria
X Y Z
. x1 y1 z1 &
x1 y2 z2
X Y X Z X Z Y Z
x1 y1 x1 z1 x1 z1 y1 z1
x1 y2 x1 z2 x1 z2 y2 z2
& . & .
X Y Z
x1 y1 z1 X Y Z
x1 y1 z2 x1 y1 z1
x1 y2 z1 x1 y2 z2
x1 y2 z2
Lossy-join decomposition Lossless-join decomposition
Outline First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form
Dependency preservation
Comments
Note that
BCNF is stronger than 3NF – if a schema R is in BCNF then
it is also in 3NF.
3NF is stronger than 2NF – if a schema R is in 3NF then it is
also in 2NF.
2NF is stronger than 1NF – if a schema R is in 2NF then it is
also in 1NF.