0% found this document useful (0 votes)
119 views62 pages

Function Dependenct

FD IN DBMS

Uploaded by

shadab qureshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
119 views62 pages

Function Dependenct

FD IN DBMS

Uploaded by

shadab qureshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Functional Dependence

X →Y
X is determinant
Y is dependent
“ X determine Y ”
“Y dependent on X ”

Database System Concepts 1.1 ©Silberschatz, Korth and Sudarshan


SP(s#, p#, city, qty)

s# city p# qty
S1 Gwl P1 100
S1 Gwl P2 100
S2 Indore P1 200
S2 Indore P2 200
S3 Indore P2 300

s# → city
(s#, p#) → qty
(s#, p#) → city
(s#, p#) → (city, qty)
(s#, p#) → s#
(s#, p#) → p#

Database System Concepts 1.2 ©Silberschatz, Korth and Sudarshan


Two types of FD’s
Time dependent – property of an instance of DB
Time independent – property of a schema of DB
R(A, B, C, D)
Let the given FD are:
A→B
B→D
Can the following tuples be inserted in the relation:
(a1, b2, c1, d3)
A B C D
(a2, b4, c4, d7) a1 b1 c2 d1
(a3, b2, c2, d3) a2 b4 c3 d5
a3 b2 c1 d3

Database System Concepts 1.3 ©Silberschatz, Korth and Sudarshan


R(A, B, C). Find FD?

A B C
a1 b1 c1
a1 b1 c2
a2 b1 c1
a2 b1 c3

A→B
C→B
(C, A) → B

Database System Concepts 1.4 ©Silberschatz, Korth and Sudarshan


Trivial & Non-Trivial FD
A dependence is trivial if its dependent (RHS) is a sub-set of
determinant (LHS).
If B is a subset of A
Then A → B is trivial

• We say that a dependency A1A2"An→B1B2"Bm is:


– Trivial if the B’s are subset of A’s.
– Nontrivial if at least one of the B’s is not among
the A’s.
– Completely nontrivial if none of the B’s is also
one of the A’s.

Database System Concepts 1.5 ©Silberschatz, Korth and Sudarshan


Axioms
Developed by Armstrong in 1974, there are 8
rules (axioms) that all possible functional
dependencies may be derived from them.

Database System Concepts 1.6 ©Silberschatz, Korth and Sudarshan


Axioms Cont.

1. Reflexivity Rule --- If X is a set of attributes and Y is


a subset of X, then X → Y holds.
each subset of X is functionally dependent on X.
2. Augmentation Rule --- If X → Y holds and W is a set
of attributes, then WX → WY holds.
3. Transitivity Rule --- If X → Y and Y → Z holds, then
X → Z holds.
4. Union Rule --- If X → Y and X → Z holds, then X
→ YZ holds.

Database System Concepts 1.7 ©Silberschatz, Korth and Sudarshan


Derived Theorems from Axioms

5. Decomposition Rule --- If X → YZ holds, then so


do X → Y and X → Z.
6. Pseudo-transitivity Rule --- If X → Y and YW → Z
hold then so does XW → Z.
If X → Y then XW → YW
If XW → YW & YW → Z then XW → Z
7. Determination Rule --- If X → X It is Trivial
8. Composition Rule --- If W→ X and Y → Z then
WY → XZ.

Database System Concepts 1.8 ©Silberschatz, Korth and Sudarshan


Closure set of FD – F+

A set of all possible FD’s that are implied by a given set S


of FD’s called the closure of S and represented by S+
Example – S = {A → B, B → C}
S+ = {A → C}
R = (A, B, C, G, H, I)
F = {A → B, A → C, CG → H, CG → I, B → H}
Find the closure of F.

Sol. A → BC, CG → HI, A → H, AG → H, AG → I

Database System Concepts 1.9 ©Silberschatz, Korth and Sudarshan


Let R(A, B, C, D)
F = { A → B, A → C, BC → D}
Find A → D is in F+.

Database System Concepts 1.10 ©Silberschatz, Korth and Sudarshan


Method 1:
A → BC
A→D
If A → B & A → C then A → BC
If A → BC & BC → D then A → D
Method 2:
Find in RHS which element is not there.
A+ = ABCD

Database System Concepts 1.11 ©Silberschatz, Korth and Sudarshan


Closure of an attribute or attribute set

Let X = BCD & F = { A → BC, CD → E, E → C, D →


AEH, ABH → BD, DH → BC}. Compute X+ of X under F.
Sol. X+ = BCD
BCD + = BCD // CD → E
= BCDE // D → AEH
= ABCDEH

R(A, B, C, G, H, I). Let X = AG & F = {A → B, A → C,


CG → HI, B → H }. Compute X+ of X under F.
Sol. X + = AG // A → B
= ABG // A → C
= ABCG // CG → HI
= ABCGHI
Hence, X+ of X under F is ABCGHI
Database System Concepts 1.12 ©Silberschatz, Korth and Sudarshan
R(A, B, C, D, E)
Let X = AB is a candidate key (given)
then Y = ABCD is super key not candidate key.
R(A, B, C, D, E)
F = { _ _ _ _ _}
A+ = _ _ _ _ _ all attribute
then A will be C.K.

Database System Concepts 1.13 ©Silberschatz, Korth and Sudarshan


R(A, B, C, D, E). Let X = ABC. Find X+ ?
F = { AB → CD, ABC → E, C → A }
Also find the candidate key of R?
F = { A → BC, CD → E, E → C, D → AEH, ABH → BD,
DH → C}
Find BCD → H is in F+ or not.
Let’s consider a relation with attributes A, B, C, D, E and
F. Suppose that this relation satisfies the FD’s:
AB→C,
BC→AD,
D→E,
CF→B.
What is {A,B}+?

Database System Concepts 1.14 ©Silberschatz, Korth and Sudarshan


• Iterations:
– X = {A,B} Use: AB→C
– X = {A,B,C} Use: BC→AD
– X = {A,B,C,D} Use: D→E
– X = {A,B,C,D,E}
– No more changes to X are possible. so X = {A,B}+.

• The FD: CF → B cannot be used because its left side is


never contained in X.

Database System Concepts 1.15 ©Silberschatz, Korth and Sudarshan


Given relation R(A, B, C, D, E) with dependencies
AC → C, CD → E, DE → B
is AB a candidate key? Is ABD a candidate key? If not then
find C.K.?
R(A, B, C, D, E)
F = { A → BC, CD → E, B → D, E → A }
a) Find B+.
b) Find candidate key of R.
c) Closure of the following set of FD.
d) Find canonical cover of F.
F = { AB → C, A → DE, B → F, F → GH, D → IJ}

Find candidate key.


Database System Concepts 1.16 ©Silberschatz, Korth and Sudarshan
Equivalent set of FD or Cover
We say that F and G are equivalent if the closure of F is
identically equal to the closure of G. i.e. F+ = G+.
Consider the following two sets of functional dependencies
F = { A → C, AC → D, E → AD, E → H } and
G = { A → CD, E → AH }
Check whether or not they are equivalent.

Database System Concepts 1.17 ©Silberschatz, Korth and Sudarshan


F = { A → C, AC → D, E → AD, E → H }
We want to prove that each FD of G is satisfied in F.
A+ = AC // A → C
= ACD // A → CD
E + = EAD // E → AD
= EADH // E → H
= EADHC // E → AH
G = { A → CD, E → AH }
Now we want to prove that each FD of F is satisfied in G.
A+ = ACD // A → C
AC+ = ACD // AC → D
E + = EAH = EAHCD // E → AD
E + = EAH = EAHCD // E → AD
Hence, we can say that F and G are equivalent.

Database System Concepts 1.18 ©Silberschatz, Korth and Sudarshan


Testing whether an FD is redundant or not
To find whether an FD is redundant or not:
Remove the FD X → Y from F (F is the set of FD)
F’ = {F – (X → Y)}
Compute X+ under the FD’s set F’
If Y subset of X+, then we can say that the FD X → Y is
redundant in F otherwise not.

If FD is redundant, it should be removed to minimize the set.

Database System Concepts 1.19 ©Silberschatz, Korth and Sudarshan


Let F = { BCD → H, A → BC, CD → E, E → C, D → AEH, ABH → BD, DH
→C}
Find whether BCD → H is redundant or not.
Sol. F’ = { F – ( BCD → H )}
F’ = { A → BC, CD → E, E → C, D → AEH, ABH → BD, DH → C }
BCD+ = BCD // in F’
= BCDE
= ABCDEH
BCD+ contains H, hence the FD BCD → H can be deduced by the remaining
set of FD’s. Hence it is redundant.

Database System Concepts 1.20 ©Silberschatz, Korth and Sudarshan


Canonical cover of FD
There is a relation R with set F of FD. G is called the
canonical cover of F if:
All FD of F are implied by G.
There is no redundant FD in G.
There is no redundant attribute on RHS.
There is no redundant attribute on LHS.

Database System Concepts 1.21 ©Silberschatz, Korth and Sudarshan


Let F = { BCD → H, A → BC, CD → E, E → C, D → AEH, ABH → BD, DH
→ C }. Find the canonical cover of F.
Sol. A) remove all redundant –
F’ = {F – (BCD → H) }
F’ = { A → BC, CD → E, E → C, D → AEH, ABH → BD, DH → C }
BCD+ = BCD // in F’
= BCDE
= ABCDEH
F’ = {F – (A → BC) }
F’ = { BCD → H, CD → E, E → C, D → AEH, ABH → BD, DH → C }
A+ = A (non redundant)
F’ = {F – (CD → E) }
F’ = { BCD → H, A → BC, E → C, D → AEH, ABH → BD, DH → C
}
CD+ = ACDEH = ABCDEH

Database System Concepts 1.22 ©Silberschatz, Korth and Sudarshan


F’ = {F – (E → C) }
F’ = { BCD → H, A → BC, CD → E, D → AEH, ABH → BD, DH → C
}
E+ = E (non redundant)
F’ = {F – (D → AEH) }
F’ = { BCD → H, A → BC, CD → E, E → C, ABH → BD, DH → C }
D+ = D (non redundant)
F’ = {F – (ABH → BD) }
F’ = { BCD → H, A → BC, CD → E, E → C, D → AEH, DH → C }
ABH+ = ABH = ABCH (non redundant)
F’ = {F – (DH → C) }
F’ = { BCD → H, A → BC, CD → E, E → C, D → AEH, ABH → BD }
DH+ = DH = ADEH = ABCDEH
Now, the final FD is
F = { A → BC, E → C, D → AEH, ABH → BD }

Database System Concepts 1.23 ©Silberschatz, Korth and Sudarshan


B) There is no redundant attribute on RHS
F = { A → BC, E → C, D → AEH, ABH → BD }
F = {A → B, A → C, E → C, D → AEH, ABH → BD }
F’ = {F – (A → B) }
F = {A → C, E → C, D → AEH, ABH → BD }
A+ = AC (non redundant)
F’ = {F – (A → C) }
F’ = {A → B, E → C, D → AEH, ABH → BD }
A+ = AB (non redundant)
F = { A → BC, E → C, D → A, D → E , D → H , ABH → BD }
F’ = {F – (D → A) }
F’ = { A → BC, E → C, D → E , D → H , ABH → BD }
D+ = DEH = CDEH (non redundant)
F’ = {F – (D → E) }
F’ = { A → BC, E → C, D → A, D → H , ABH → BD }
Database System Concepts 1.24 ©Silberschatz, Korth and Sudarshan
D+ = DAHBC (non redundant)
F’ = {F – (D → H) }
F = { A → BC, E → C, D → A, D → E , ABH → BD }
D+ = DAEBC (non redundant)
F = { A → BC, E → C, D → AEH, ABH → BD }
F = { A → BC, E → C, D → AEH, ABH → B , ABH → D }
TRIVIAL
Final FD is
F = { A → BC, E → C, D → AEH, ABH → D }

Database System Concepts 1.25 ©Silberschatz, Korth and Sudarshan


C) There is no redundant attribute on LHS
ABH → D Is A redundant?
F’ = { A → BC, E → C, D → AEH, BH → D }
Find BH+ for F’
BH+ = BHD = ABHDE = ABHDEC
Hence A is redundant.
F’ = { A → BC, E → C, D → AEH, AH → D }
Find AH+ for F’
AH+ = AHDBC = AHDBCE
Hence B is redundant.
F’ = { A → BC, E → C, D → AEH, AB → D }
Find AB+ for F’
AB+ = ABCDEH
Hence H is redundant.
So final F = { A → BC, E → C, D → AEH }
Database System Concepts 1.26 ©Silberschatz, Korth and Sudarshan
Ist Normal Form
A relation is in Ist NF
a) If the domain of all attributes are scalar or atomic (i.e. non
composite ) only.
b) There are no repeating groups in the tuples.
Eg – student(rollno, name(fname, lname), dob(dd, mm, yy),
marks)
Attributes name and date are composite.
student( rollno, marks)
name(rollno, fname, lname)
dob(rollno, dd, mm, yy)

Database System Concepts 1.27 ©Silberschatz, Korth and Sudarshan


Teacher Course Text
Prof. Ram Physics Mechanics
Prof. Shyam Optics
Prof. Ram Mathematics Algebra
Calculus

It is containing repeating groups.

Database System Concepts 1.28 ©Silberschatz, Korth and Sudarshan


Full Functional Dependence
Also called left irreducible.
Eg.- Relation R(A, B, C, D, E)
There is a FD ACD → E
If any of the following FD holds true:
A→E
C→E
D→E
AC → E
AD → E
CD → E
Then the dependence ACD → E is partial or left reducible
dependence.
Database System Concepts 1.29 ©Silberschatz, Korth and Sudarshan
There is a FD BD → C
But none of the following FD’s are true:
B→C
D→C
Then the dependence BD → C is full or left irreducible
dependence.

Database System Concepts 1.30 ©Silberschatz, Korth and Sudarshan


Transitive Dependence
If the two FD’s hold true:
X→Y
Y→Z
then transitivity:
X → Z will be true.

Prime & Non-prime Attribute


The attributes that are components of any candidate key of a a
relation are called prime attribute.
Eg- R(A, B, C, D, E)
If AB & BD are C.K.
Then A, B, D are prime attributes and C, E are called non-
prime attributes.

Database System Concepts 1.31 ©Silberschatz, Korth and Sudarshan


II Normal Form
A relation is in IInd NF
a) If the domain of all attributes are scalar or atomic (i.e. non
composite ) only.
b) All non-prime attributes are fully functionally dependent (
or left-irreducibly dependent) on the primary key.
Eg – SP(s#, sname, address, p#, pname, pdetails, city, status,
qty)
The P.K. (s#, p#)
The FD are represented by FD diagram -

Database System Concepts 1.32 ©Silberschatz, Korth and Sudarshan


sname status

address s# city

qty p# pdetails

pname
The above relation is not in 2nd NF because every
dependence except { s#, p#} → qty is implied by proper
subsets of P.K.

Database System Concepts 1.33 ©Silberschatz, Korth and Sudarshan


s# sname address p# pname pdetails city status qty
S1 XYZ BADA P1 mouse logitech Gwl 40 15
S1 XYZ BADA P2 CPU P-3 Gwl 40 18
S1 XYZ BADA P3 KB cherry Gwl 40 28
S2 ABC HAZIRA P2 CPU P-3 Bhopal 50 15
S3 PQR MORAR P2 CPU P-3 Delhi 100 10

Disadvantages –
Redundancy
Update – update address of S1
Insertion – to insert S4 as a new supplier from which we have not
started purchasing.(but p# is a PK)
Deletion – if S2 is deleted, it will delete all information about city,
status (P2)

Database System Concepts 1.34 ©Silberschatz, Korth and Sudarshan


Hence, we decompose it -
SP1 (s#, sname, address, city, status)
SP2 (p#, pname, pdetails)
SP3 (s#, p#, qty)

Database System Concepts 1.35 ©Silberschatz, Korth and Sudarshan


III Normal Form
A relation is in IIIrd NF
a) All attributes are atomic i.e. it is in 1st NF.
b) All non-prime attributes are fully functionally dependent
on the primary key i.e. it is in 2nd NF.
c) All non-prime attribute are non-transitively dependent
upon the primary key.
status
transitivity

address s# city

sname

Database System Concepts 1.36 ©Silberschatz, Korth and Sudarshan


s# sname address city status
S1 XYZ BADA Gwl 40
S1 XYZ BADA Gwl 40
S1 XYZ BADA Gwl 40
S2 ABC HAZIRA Bhopal 50
S3 PQR MORAR Delhi 100

Disadvantages –
Redundancy
Update – update status of Gwl from 40 to 50
Insertion – to insert new city with no supplier
Deletion – if S3 is deleted, it will delete all information about city.
Hence,
S31( s#, sname, address, city)
S32 ( city, status)

Database System Concepts 1.37 ©Silberschatz, Korth and Sudarshan


III Normal Form ( another definition)
A relation schema R is in 3rd NF if whenever a FD X → A
holds in R, then either:
a) X is a superkey of R or
b) A is a prime attribute of R

NOTE: Boyce-codd NF disallows condition (b) above. So


BCNF is stronger as compared to 3rd NF.

Database System Concepts 1.38 ©Silberschatz, Korth and Sudarshan


Non – loss Decomposition -
The process of normalization causes decomposition of the
relation. Every information in the original relation must be
preserved in the decomposed relations.
The information is in 3 forms –
a) In attributes R = R1 U R2 U R3 U…..U Rn
b) In tuples r = r1 r2 r3 …….. rn

c) In functional dependence F1+ U F2+ U….U Fn+ = F+


All the three must be preserved during decomposition.

Database System Concepts 1.39 ©Silberschatz, Korth and Sudarshan


Lossless - join Decomposition

It is based on tuple preservation only i.e. (b)


let R = (R1, R2)
r = ∏R1 (r) ∏R2 (r)
A decomposition of R into R1 & R2 is lossless join if and
only if at least one of the following dependencies is in F+
R1 ∩ R2 → R1
or
R1 ∩ R2 → R2
NOTE: Super key of R1 or R2

Database System Concepts 1.40 ©Silberschatz, Korth and Sudarshan


Example –
R(A, B, C)
F = {A → B, B → C }
Can be decomposed into 2 different ways:
i) R1 = (A, B) R2 = (B, C)
lossless join decomposition:
R1 ∩ R2 → { B } and B → BC
Dependency preserving
ii) R1 = (B, C) R2 = (A, C)
lossless join decomposition:
R1 ∩ R2 → { C } and C→C
C is neither super key of R1 nor the super key of R2.
Hence the decomposition is not lossless join.
Database System Concepts 1.41 ©Silberschatz, Korth and Sudarshan
Prove that “BCNF is stronger as compared to 3rd NF”. Is it
true.
A relation schema R is in BCNF if whenever an FD
X→A
holds in R, then X is a superkey of R.
Lets take an example-
There is a relation R(A, B, C) with FD’s F = {AB → C , C → B }
The CK is {AB, AC}
A+ = A
AB + = ABC
AC + = ACB

Database System Concepts 1.42 ©Silberschatz, Korth and Sudarshan


R is in 3NF because
AB → C AB is a SK
C→B B is a prime attribute
R is not in BCNF because
C→B C is not SK

So we break it-
R1(A, B)
R2(A, C) there is no FD
Another break-
R1(A, B)
R2(B, C) there is only one FD i.e. C → B but not AB → C
Hence BCNF is stronger as compared to 3NF.
Database System Concepts 1.43 ©Silberschatz, Korth and Sudarshan
BCNF 3NF
Lose FD Preserve FD
Reduce redundancy Tolerate some
redundancy
NOTE – FD is more important than redundancy.
Hence 3NF is preferred as compare to BCNF.

A B C
a1 b1 c1
a2 b1 c1
a3 b1 c1
a4 b2 c2
Repetition of information (i.e. relationship b1, c1)

Database System Concepts 1.44 ©Silberschatz, Korth and Sudarshan


R = { A, B, C, D, E, F, G, H, I, J }
F = { AB → C, A → DE, B → F, F → GH, D → IJ }
Find candidate key? Decompose R into 2NF, then 3NF relation.

AB+ =

Database System Concepts 1.45 ©Silberschatz, Korth and Sudarshan


R = { A, B, C, D, E, F, G, H, I, J }
F = { AB → C, A → DE, B → F, F → GH, D → IJ }
Find candidate key? Decompose R into 2NF, then 3NF
relation.
AB+ =
II NF
A relation is in IInd NF
a) If the domain of all attributes are scalar or atomic (i.e. non
composite ) only.
b) All non-prime attributes are fully functionally dependent (
or left-irreducibly dependent) on the primary key.

The R relation is not in 2NF because FD 2, 3, 4, 5 are


violating 2NF criteria. So we break it
Database System Concepts 1.46 ©Silberschatz, Korth and Sudarshan
R1( A, B, C ) F1 = { AB → C }
R2( A, D, E, I, J ) F2 = { A → DE, D → IJ }
R3( B, F, G, H ) F3 = { B → F, F → GH }
Prove that there is loss-less (non-loss) decomposition
a) Attribute preservation
R = R1 U R2 U R3
b) Tuple preservation
R1 ∩ R2 → A is the C.K. of R2
R1 ∩ R2 → B is the C.K. of R3
c) FD preservation
F = F1 U F2 U F3

Database System Concepts 1.47 ©Silberschatz, Korth and Sudarshan


III NF
A relation is in IIIrd NF
a) All attributes are atomic i.e. it is in 1st NF.
b) All non-prime attributes are fully functionally dependent
on the primary key i.e. it is in 2nd NF.
c) All non-prime attribute are non-transitively dependent
upon the primary key.
R1 is in III NF
R2 is not in 3NF
R2( A, D, E, I, J )
F2 = { A → DE, D → IJ }
violating 3NF
So we break it
Database System Concepts 1.48 ©Silberschatz, Korth and Sudarshan
R21( A, D, E ) F21 = { A → DE}
R22( D, I, J ) F22 = { D → IJ }
Prove that there is loss-less (non-loss) decomposition
i) Attribute preservation
R2 = R21 U R22
ii) Tuple preservation
R21 ∩ R22 → D is the C.K. of R22
iii) FD preservation
F2 = F21 U F22
R3 is not in 3NF
R3( B, F, G, H ) F3 = { B → F, F → GH }
violating 3NF
So we break it
Database System Concepts 1.49 ©Silberschatz, Korth and Sudarshan
R31( B, F ) F31 = { B → F}
R32( F, G, H ) F32 = { F → GH }
Prove that there is loss-less (non-loss) decomposition
i) Attribute preservation
R3 = R31 U R32
ii) Tuple preservation
R31 ∩ R32 → F is the C.K. of R32
iii) FD preservation
F3 = F31 U F32
So, R is decomposed in –
R1( A, B, C )
R21( A, D, E )
R22( D, I, J )
R31( B, F )
R32( F, G, H )

Database System Concepts 1.50 ©Silberschatz, Korth and Sudarshan


Consider the universal relation
R = { A, B, C, D, E, F, G, H, I, J } and the set of functional
dependencies
G = { AB → C, BD → EF, AD → GH, A → I, H → J }
What is the key for R? Decompose R into 2NF, then in 3NF
relation.

Database System Concepts 1.51 ©Silberschatz, Korth and Sudarshan


Multi-valued dependence
Any FD that does not have its determinant as C.K. / S.K. will
certainly create redundancy & anomaly.
MVD – atleast 3 attribute or 3 sets of attributes r required.
R(A, B, C)
A -->> B with respect to C // B multidependent on A

b1
a1, c2 b2
b5

A -->> C wrt B If for c4


a4, b6 c7
A -->> B c2

Database System Concepts 1.52 ©Silberschatz, Korth and Sudarshan


Teacher Course Text
Prof. Ram Physics Mechanics
Prof. Shyam Optics
Prof. Ram Mathematics Algebra
Calculus

Database System Concepts 1.53 ©Silberschatz, Korth and Sudarshan


Course Teacher Text
Physics Prof. Ram Mechanics
Physics Prof. Ram Optics
Physics Prof. Shyam Mechanics
Physics Prof. Shyam Optics
Mathematics Prof. Ram Algebra
Mathematics Prof. Ram Calculus

• P.K. (Course, Teacher, Text)


Course -->> Text with respect to Teacher

Course -->> Teacher with respect to Text

Database System Concepts 1.54 ©Silberschatz, Korth and Sudarshan


Course -->> Teacher/Text
R1 = {A, B}
1:M One relation
R2 = {A, C} R(A, B, C)
1:N MVD
A -->> BC
Disadvantage:
Redundancy – Text is stored at multiple places.
Update – If Mechanics modify, then we have to change Mechanics in
all place where it is. Otherwise, create inconsistency
Delete – If Prof. Ram (Maths) deleted then information about Text and
Course will be deleted.
Insert – If new Prof. comes (Maths) then require two entries because of
2 text

Database System Concepts 1.55 ©Silberschatz, Korth and Sudarshan


NOTE – when 2 independent one to many relationship are mixed
in some relation, a MVD arises
Example – A : B & A : C
A -->> B | C
Similarly
Course : Teacher & Course : Text
Course -->> Teacher | Text

A B C
t1 a1 b1 c1
t2 a1 b2 c2

A -->> B | C

Database System Concepts 1.56 ©Silberschatz, Korth and Sudarshan


If t1[A1] = t2[A2]
then two tuples t3 & t4 should also exist
A B C
t1 a1 b1 c1
t2 a1 b2 c2
t3 a1 b1 c2
t4 a1 b2 c1

To avoid inconsistency.

Database System Concepts 1.57 ©Silberschatz, Korth and Sudarshan


List all the MVD satisfied by the following relation

A B C
a1 b1 c1
a1 b1 c2
a2 b1 c1
a2 b1 c3

c1
b1 -->> a1 | c1 a1 c2
b1 -->> a1 | c2 b1
b1 -->> a2 | c1 a2 c1
b1 -->> a2 | c3 c3

Database System Concepts 1.58 ©Silberschatz, Korth and Sudarshan


IV NF
A relation R is in 4NF iff every multi-valued dependence on R is
implied by the C.K. only
Example – The relation R (Course, Teacher, Text) is not in 4NF
because the MVD
Course -->> Teacher | Text
is there, which is not implied by the C.K. i.e. Course + Teacher + Text
So, the relation has to be decomposed
R1( Course, Teacher )
R2( Course, Text ) Course Text
Course Teacher Physics Mechanics
Physics Prof. Ram Physics Optics
Physics Prof. Shyam Mathematics Algebra
Mathematics Prof. Ram Mathematics Calculus
This relation does not suffer from above disadvantage of MVD.
These 2 relations are not in MVD because for MVD, it requires atleast 3
attributes
Database System Concepts 1.59 ©Silberschatz, Korth and Sudarshan
Join Dependence
SPJ ( S#, P#, J#) // SPJ is P.K. SP S# P#
S1 P1
S# P# J#
S1 P2
S1 P1 J2
S2 P1
S1 P2 J1
S2 P1 J1
S1 P1 J1 P# J#
PJ P1 J2
P2 J1
SPJ1 = SP PJ
P1 J1
S# P# J#
S1 P1 J2
JS J# S#
S1 P1 J1
J2 S1
S1 P2 J1 J1 S1
S2 P1 J2 J1 S2
S2 P1 J1
Database System Concepts 1.60 ©Silberschatz, Korth and Sudarshan
SPJ2 = SPJ1 SJ

S# P# J#
S1 P1 J2
S1 P2 J1
S2 P1 J1
S1 P1 J1

So, this relation suffers from join dependence.

Database System Concepts 1.61 ©Silberschatz, Korth and Sudarshan


5 NF ( Projection join NF )

A relation R is in PJNF iff every join dependence in R is implied


by the C.K. of R only.

Database System Concepts 1.62 ©Silberschatz, Korth and Sudarshan

You might also like