Professional Documents
Culture Documents
No, R w.r.t. F is NOT in 3NF, because CD→A violates the 3NF requirements.
i.e.
CD→A is not trivial FD
CD is not a superkey
CD is not a key, but A is not part of any key of R either
Decomposition #1:
CD→A is a violating FD
R1 (A,C,D):
We need to project FDs F onto relation R1:
A+ = A
C+ = CDA (C →DA)
D+ = D
AC+ = ACD (AC→D)
AD+ = AD
CD+ = CDA (CD → A)
So, F1 = {C→DA, AC→D, CD→A}
R2 ( B,C,D,E,F,G,H):
In general, we should project F onto R2. However, if we look carefully, we can easily see that the
only difference between R and R2 is attribute A. Attribute A has never appeared on LHS of any
FD. So, removing it won’t make any change in F2.
Consider R1(A,C,D):
1
F1 = {C→DA, AC→D, CD→A}
Consider R2:
F2={EC→H, C→D, H→B, BE→CD, EC→B}
Keys of R2 = Keys of R = {BEFG, CEFG, EFGH}
Decomposition #2:
C→D is a violating FD
R22 (B,C,E,F,G,H):
In general, we should project F2 onto R22. However, if we look carefully, we can easily see that the
only difference between R2 and R22 is attribute D. Attribute D has never appeared on LHS of any
FD. So, removing it won’t make any change in F22.
Consider R21(C,D):
F21={C→D}
Since C+=CD, C is a key. Therefore, we have no violating FD. (So, we are done with this branch.)
Consider R22(B,C,E,F,G,H):
Keys of R22 = Keys of R2 = {BEFG, CEFG, EFGH}
2
F22 = {EC→H, H→B, BE→C, EC→B}
Overall, we have:
R1 (A, C, D) F1 = {C→DA, AC→D, CD→A}
R21 (C, D) F21 = {C→D}
R22 (B, C, E, F, G, H) F22 = {EC→H, H→B, BE→C, EC→B}
3
2. Synthesis Approach:
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}
The candidate keys are {BEFG, CEFG, EFGH}
In the last tutorial, we found that the canonical cover for F is:
F = {C→AD, EC→H, GH→A, EG→A, H→B, BE→C}
C
Now, we need to check if at least one of the keys exists in the above relations.
The candidate keys are {BEFG, CEFG, EFGH}
Since none of these keys is in the relations, this decomposition is not lossless. So, we need to add
an extra relation containing those attributes that form any key of R:
R7 = {B, E, F, G} F7 = {}
4
Question 2
Check if the decomposition of R(A, B, C, D, E, F, G) with the set of FDs
F={C→AD, E→G, FG→A, EF→A, G→B, BE→C}
into the following relations is lossless join.
R1 = {A, C, D}
R2 = {E, C, G}
R3 = {A, F, G}
R4 = {A, E, F}
R5 = {B, G}
R6 = {B, C, E}
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} b2A b2B a b2D a b2F a
R3={A,F,G} a b3B b3C b3D b3E a a
R4={A,E,F} a b4B b4C b4D a a b4G
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} b6A a a b6D a b6F b6G
Round 1
Considering C→AD
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} new b2B a new a b2F a
a a
R3={A,F,G} a b3B b3C b3D b3E a a
R4={A,E,F} a b4B b4C b4D a a b4G
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} new a a new a b6F b6G
a a
Considering E→G
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a b2B a a a b2F a
R3={A,F,G} a b3B b3C b3D b3E a a
R4={A,E,F} a b4B b4C b4D a a new
a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F new
a
5
Considering FG→A
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a b2B a a a b2F a
R3={A,F,G} a b3B b3C b3D b3E a a
R4={A,E,F} a b4B b4C b4D a a a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a
Considering EF→A
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a b2B a a a b2F a
R3={A,F,G} a b3B b3C b3D b3E a a
R4={A,E,F} a b4B b4C b4D a a a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a
Considering G→B
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a new a a a b2F a
a
R3={A,F,G} a new b3C b3D b3E a a
a
R4={A,E,F} a new b4C b4D a a a
a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a
Considering BE→C
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a a a a a b2F a
R3={A,F,G} a a b3C b3D b3E a a
R4={A,E,F} a a new b4D a a a
a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a
6
Round 2
Considering C→AD
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a a a a a b2F a
R3={A,F,G} a a b3C b3D b3E a a
R4={A,E,F} a a a new a a a
a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a
We don’t need to continue since we found one row in the table with all cells having a
So, this is a lossless join.
A B C D E F G
R1={A,C,D} a b1B a a b1E b1F b1G
R2={E,C,G} a a a a a b2F a
R3={A,F,G} a a b3C b3D b3E a a
R4={A,E,F} a a a a a a a
R5={B,G } b5A a b5C b5D b5E b5F a
R6={B,C,E} a a a a a b6F a