Functional Dependency
Functional Dependency
Functional Dependency
FUNCTIONAL DEPENDENCIES
K.Yeshwanth
M.sc-CS
2022239008
2
X->Y
X=>determinant set
Y=>determinant attribute
Y is functionally dependent on X
4
CLOSURE OF ATTRIBUTE:
• The closure of a set of attributes X is the set of
those attributes that can be functionally
determined from X.
CLOSURE OF ATTRIBUTE:
• Consider a relation R with attributes A,B,C and
D where,
A->B
B->D
C->B
In this case the closure of A is,
{A+ } -> {A,B,D}
8
• Denoted as F+.
9
EXAMPLE:
Let us apply our rules to the example
of schema R(A, B, C, G, H, I) and the
set F of functional dependencies
{A→B, A→C,CG→H, CG→I, B→H}.
• A →H.(Transitivity rule)
• AG →I.(Pseudotransitivity rule)
12
CANONICAL COVER:
• In DBMS, a canonical cover is a set of functional
dependencies that is minimal, irreducible, and
equivalent to the original set of dependencies.
CANONICAL COVER:
• To achieve this we have to follow 3 rules:
Make singleton attribute in RHS.
No functional dependency in Fc contains an
extraneous attribute in LHS.
No redundant functional dependency.
o A->B
o A->C
F becomes,
F= {A->B, A->C , B->C, AB->D}.
16
LOSSLESS DECOMPOSITION:
• A decomposition (R1,R2,R3……..Rn) of a relation
R is called lossless decomposition for R, if the
natural join of R1,R2,R3……..Rn produces
exactly the value of R.
LOSSLESS DECOMPOSITION:
20
LOSSY DECOMPOSITION:
21
DEPENDENCY PRESERVATION:
• A decomposition D={R1,R2,…,Rn} of R is
dependency preserving with respect to set F of
functional dependency if closure(F1 U F2 U….U
Fn)=closure(F).
SOLUTION:
• Let’s say relation R is decomposed into R1, R2
and R3 with functional dependency F1, F2 and
F3 respectively,
Here, C and D are not Here, D is not present Here, C is not present
present in the sub- in the sub-relation R2. in the sub-relation R3.
relation R1.
Closure(C)=CBD Closure(D)=DBC
Closure(B)=BCD C->B, C->D D->B, D->C
SOLUTION:
Now F1 U F2 U F3 is,
F1 U F2 U F3={A->B, B->C, C->B, B->D, D->B}.
Given,
F={A->B, B->C, C->D, D->B}.
Using transitivity rule,
If C->B and B->D holds, then C->D holds.
(F1 U F2 U F3)+={A->B, B->C, C->D, D->B}.
(F)+={A->B, B->C, C->D, D->B}.
Hence the dependency is preserved.
26
THANK YOU!