Smu CS7330_Howework2
Smu CS7330_Howework2
c) Incompatible tuples:
Let's check each pair against the FDs:
i. (a1,b1,c1,d1,e1), (a1,b2,c2,d2,e2)
- Same A but different B and E violates BE → A
Cannot coexist
ii. (a1,b1,c1,d1,e1), (a1,b2,c1,d2,e1)
- Same C,A but different D violates CA → D
Cannot coexist
iii. (a1,b1,c1,d1,e1), (a1,b2,c1,d1,e2)
- Same A but different B and E violates AB → E
Cannot coexist
iv. (a1,b1,c1,d1,e1), (a1,b1,c2,d2,e1)
- No violation of FDs
Can coexist
Answer for c): Options i, ii, and iii are correct
Final answers:
a) ii and iii (BCE and ABC)
b) i and ii (ABCD,BCDE and ABE,BCDE)
c) i, ii, and iii
2)
a) Let's find attribute closure systematically to find candidate keys:
We need all attributes not appearing on RHS as potential part of
candidate key:
* A appears on RHS of AFG→E
* D appears only on LHS
* E appears on RHS of AFG→E
* F appears on RHS of EG→F
* G appears on RHS of CD→G
Starting with AD (smallest combination of attributes not appearing on
RHS):
AD+ = {A,D}
* Using A→B: {A,B,D}
* Using A→C: {A,B,C,D}
* Using CD→G: {A,B,C,D,G}
* Using EG→F: Cannot use yet (missing E)
* Using AFG→E: Cannot use yet
Need to add E:
ADE+ = {A,D,E}
* Using A→B: {A,B,D,E}
* Using A→C: {A,B,C,D,E}
* Using CD→G: {A,B,C,D,E,G}
* Using EG→F: {A,B,C,D,E,F,G}
* Using AFG→E: Already have all attributes
Final Answer:
a) The only candidate key is ADE
b) BCNF decomposition: R1(A,B), R2(A,C), R3(A,D,E,F,G)
c) BCNF Analysis:
For BCNF, for every FD X→A, X must be a superkey.
Checking each FD:
1) B→T: B is not a superkey (B cannot determine all attributes)
2) BY→P: BY is a superkey (okay)
3) PY→M: PY is not a superkey
4) MY→T: MY is not a superkey
Therefore, the relation is NOT in BCNF because of violations from B→T,
PY→M, and MY→T.
d) 3NF Analysis:
For 3NF:
- Either X must be a superkey, OR
- A must be part of some candidate key
Checking each FD:
1) B→T:
- B is not a superkey
- T is not part of any candidate key
- Violates 3NF
2) BY→P:
- BY is a superkey
- Satisfies 3NF
3) PY→M:
- PY is not a superkey
- M is not part of any candidate key
- Violates 3NF
4) MY→T:
- MY is not a superkey
- T is not part of any candidate key
- Violates 3NF
Therefore, the relation is NOT in 3NF because multiple FDs violate
the conditions.
Final Answer:
a) FDs: B→T, BY→P, PY→M, MY→T
b) Candidate key: BY
c) Not in BCNF because B→T, PY→M, and MY→T violate BCNF
requirements (their LHS are not superkeys)
d) Not in 3NF because in multiple FDs (B→T, PY→M, MY→T), the RHS
attributes are not part of any candidate key and the LHS are not super
keys.