.
.
Winter 2008
CPE/CSC 366:
Database Modeling, Design and Implementation
Alexander Dekhtyar
.
.
Decomposition of Functional Relations
Examples
Closure Algorithm
Example 1.
Consider a relation
R
(
A,B,C,D,E,F
) with asserted FDs
(1)
A
→
B,C
(2)
F
→
E
(3)
B,F,E
→
D
(4)
A,D
→
E
(5)
C,E,
→
D,F
Problem 1:
Find
{
A
}
+
.
Solution
. We start with set
X
0
=
{
A
}
.
The left side of FD (1) is
A
⊆
X
0
. We set
X
1
=
{
A
} ∪ {
B,C
}
=
{
A,B,C
}
.
The left sides of FDs (2),(3),(4),(5) are not proper subsets of
X
1
. Therefore,
{
A
}
+
=
X
1
=
{
A,B,C
}
.
Problem 2:
Find
{
A,D
}
+
.
Solution
. We start with set
X
0
=
{
A,D
}
.
The left side of FD (1) is
{
A
} ⊆
X
0
. We set
X
1
=
{
A
}∪{
B,C
}
=
{
A,B,C
}
.
The left side of FD (4) is
{
A,D
} ⊆
X
1
. We set
X
2
=
X
1
∪{
E
}
=
{
A,B,C,D,E
}
.
The left side of FD (5) is
{
C,E
} ⊆
X
2
. We set
X
3
=
X
2
∪ {
D,F
}
=
{
A,B,C,D,E,F
}
.
X
3
contains all attributes from
R
, therefore
{
A,D
}
+
=
X
3
=
{
A,B,C,D,E,F
}
.
FD Projection Algorithm
Example 2.
Consider a relation
R
(
A,B,C,D,E,F
) with asserted FDs
(1)
A
→
B,C
(2)
F
→
E
(3)
B,F,E
→
D
(4)
A,D
→
E
(5)
C,E,
→
D,F
Problem 1:
Find FDs asserted on
R
1
=
π
A,B,C,D
(
R
)
1