Professional Documents
Culture Documents
Normal Forms
1
Canonical Cover
2
Canonical Cover
A canonical / minimal cover of F is a set G of
FDs that satisfies the following:
1. G is equivalent to F; that is, G ≡ F
2. G is minimal; that is, if we obtain a set H of FD’s
from G by deleting one or more of its FD’s, or by
deleting one or more attributes from some FD in
G, then F ≢ H
3. Every FD in G is of the form X A, where A is a
single attribute 3
Computing Canonical Cover
Step 1: Put the FD’s in the simple form
Initialize G := F
Replace each FD X → A1A2…Ak in G with X→A1,
X→A2, …, X→Ak
Step 2: Minimize the left hand side of each FD
E.g., for each FD AB → C in G, check if A or B on the
LHS is redundant , i.e., (G {AB → C } ⋃ {A → C })+ ≡
F+?
Step 3: Delete redundant FD’s
For each FD X → A in G, check if it is redundant, i.e.,
whether (G {X → A })+ ≡ F+?
4
Exercise #1
Consider R = {A, B, C, D, E, F, G, H} with a
set of FDs
F = {CD→A, EC→H, GHB→AB, C→D,
EG→A, H→B, BE→CD, EC→B}
5
Normal Forms
6
Types of Normal Forms
Examples of normal forms:
First normal form (1NF)
Second normal form (2NF)
Third normal form (3NF)
Boyce-Codd normal form (BCNF)
These normal forms have increasingly restrictive
requirements
7
First Normal Form (1NF)
A relation schema R is in the first normal
form if the domain of its each attribute has
only atomic values (No attribute is allowed to
be composite or multi valued)
Example: The following relation is not in 1NF
Student (SID, SName, {(CourseId, CouseName,
Grade)})
8
Second Normal Form (2NF)
A relation schema R w.r.t. F is in 2NF if:
1. It is in 1NF
2. Every Non-Primary-Key attribute is fully
functionally dependent upon the ENTIRE
Primary-Key for its existence
For each non-key attribute, ask:
If I knew the value for part of the Primary-Key,
could I tell what the value for non-key attribute
would be?
9
2NF – Example - 1
Inventory (Item, Supplier, Cost, Supplier Address)
We first check if Cost is fully functionally dependent upon
the ENTIRE Primary-Key
If I know just Item, can I find out Cost?
No. We can have > 1 supplier for the same product.
10
2NF – Example - 2
Inventory (Item, Supplier, Cost, Supplier Address)
We then check if Supplier Address is fully functionally
dependent upon the ENTIRE Primary-Key
If I know just Item, can I find out Supplier Address?
No. We can have > 1 supplier for the same product.
X is a super key
Is R w.r.t. F in 3NF?
14
Exercise #3
Consider R = {A, B, C, D, E, F, G} with a set
of FDs
F = {ABC→DE, AB→D, DE→ABCF, E→C}
Is R in BCNF, 3NF, or neither?
15