]
>
Additional Dependencies and Normalizations
Additional Dependencies and Normalizations
13.1 Multivalued Functional Dependencies (MVDs)
Not all redundancies are detectable by FDs.
A schema in BCNF:
Course Quarter Days
670 Spring TR
670 Autumn MWF
680 Autumn MWF
670 Spring MWF
670 Autumn TR
680 Autumn TR
Yet they may be still eliminated by decompositions
Qu a r t e r s
Course Quarter
670 Spring
670 Autumn
680 Autumn
Da y s
Course Days
670 MWF
670 TR
680 MWF
680 TR
Days are independent of quarters
Y is multivalued
dependent on X
over R ,
denoted X → → Y ,
if
X → → Y is trivial if
X includes
Y or
R − X Y is empty
Course Quarter Days
670 Spring TR
670 Autumn MWF
Course Quarter Days
670 Spring MWF
670 Autumn TR
Testing Algorithm:
X → → Y iff
R − X = Y × ( R − X Y ) for each
tuple in X .
Course Quarter Days
670 Autumn MWF
670 Autumn TR
670 Spring MWF
670 Spring TR
680 Autumn MWF
680 Autumn TR
equal?
Course Quarter Days
670 Autumn, Spring
MWF, TR
680 Autumn
MWF, TR
13.2 Inference Rules for MVDs
FD reflexitivity (Armstrong): X → Y if
Y ⊆ X
FD augmentation (Armstrong): X Z → Y Z
if X → Y
FD transitivity (Armstrong): X → Z
if X → Y and
Y → Z
MVD augmentation: X W → → Y Z
if X → → Y and
Z ⊆ W
MVD transitivity: X → → Z − Y
if X → → Y and
Y → → Z
MVD complementation: X → → R − X Y
if X → → Y
Replication: X → → Y if
X → Y
Coalescence: X → Z if
X → → Y ,
W → Z ,
Z ⊆ Y , and
W and
Z are
disjoint
The set of inference rules is sound and complete.
Given: A → B C D B → → C
Implied:B → C
From:
Additional Inference Rules
MVD union: X → → Y Z if
X → → Y ,
X → → Z
MVD pseudotransitivity: W X → → Z − W Y if
X → → Y ,
W Y → → Z
MV mixed pseudotransitivity: X → Z − Y if
X → → Y ,
X Y → Z
MVD decomposition: X → → Y ∩ X ,
X → → Y − Z ,
X → → Z − Y if
X → → Y ,
X → → Z
13.3 Fourth Normal Form
X is a superkey in
each nontrivial X → → Y
Course is not a superkey in
Course Quarter Days
670 Autumn MWF
670 Autumn TR
670 Spring MWF
670 Spring TR
680 Autumn MWF
680 Autumn TR
If X is a
superkey then each partition holds exactly one tuple
Result: The decomposition X ∪ Y ,
R − Y is lossless
join if X → → Y .
The following relation
R
is in BCNF, but not in 4NF
A B C D
1 1 1 1
1 2 1 1
2 1 1 1
2 2 1 1
3 1 1 2
1 3 3 2
4 1 2 2
R is not in
4NF:
MVD: C D → → A
C D is not a
superkey
R in
BCNF
A B a primary
key ( A B → C D )
2NF: C and
D fully
dependent on A B
3NF: C
and D
don’t depend on one another
BCNF: neither A
nor B depend
on C or
D
The decomposition { C , D , A }
and { C , D , B } has
the lossless join property.
13.4 Degrees of Decompositions
Up to 4NF, we considered decompositions replacing a relation by two of its projections
Some relations require higher degree of decomposition to have lossless join
R = R 1 ⋈ R 2 ⋈ R 3
R
A B C
a1 b1 c2
a1 b2 c1
a2 b1 c1
a1 b1 c1
None of the pairs provide lossless join decomposistion
R 1 ⋈ R 2
A B C
a1 b1 c2
a1 b2 c1
a2 b1 c1
a1 b1 c1
a2 b1 c2
13.5 Join Dependencies (JDs)
A lossless join decomposition defines a constraint on the entries of the decompompostion
if <a,b> is a tuple in R1 and <b,c> is a tuple in R2 and <c,a> is a tuple in R3 then <a,b,c> is a tuple in
R
The condition on each projection can be expressed in terms of the original relation
<a,b> is in R1 iff <a,b,...> is in R <b,c>
is in R2 iff <...,b,c> is in R <c,a>
is in R3 iff <a,...,c> is in R
The above observations imply join dependency constraints
if <a,b,...> , <...,b,c> , and <a,...,c> are in R then <a,b,c> is in R
The schemas R 1 , ...,
R n have a join dependency
over R , if they define a lossles-join
decomposition over R .
JDs don’t have a sound and complete set of inference rules.
A JD is trivial if R = R i
for some i
13.6 Fifth (Project-Join) Normal Form
A relation R is in 5NF iff in
every join dependency each R i
is a super key of R .
13.7 Assignment #7
Due: Mo, Mar 2
Problems 11.24, 11.29 (page 359 4th ed; 409 5th ed),
Notes
If you submit your homework electronically, use the departmental submit utility: submit XXX lab7
filename . XXX represents ‘c670aa ’ for students of the 3:30 section, and ‘c670ab ’ for students of the 5:30
section.
Files are restricted to 1,048,576 bytes
The submit program issues error messages to the student’s CSE email account
Q&A