Question 1

Consider the following set F of functional dependencies on the relation schema (A, B, C, D, E, G):

  1. schema R = {A, B, C, D, E, G}
  2. F = {
  3. A BCD
  4. BC DE
  5. B D
  6. D A
  7. }

a. Compute B+.

  1. F = {
  2. A > B, A > C, A > D, BC > D, BC > E, B > D, D > A
  3. A > B, A > C, A > D, BC > D, BC > E, B > A
  4. B > B, B > C, B > D, BC > D, BC > E
  5. BC > E, B > C => B > E
  6. }
  7. (B) += {A, B, C, D, E}

:::success { A > BCD, BC > DE, B > D, D > A }

a. Compute B+.
Dependencies:

  • B > BD (Third dependency)
  • BD > ABD (Fourth dependency)
  • ABD > ABCD ( First dependency)
  • ABCD > ABCDE (Second Dependency)

Thus, B+ = ABCDE :::

b. Prove (using Armstrong’s axioms) that AG is a superkey.

  1. Given that,
  2. A > BCD
  3. A > ABCD (Increase with A)
  4. BC > DE
  5. ABCD > ABCDE (Increase with ABCD)
  6. A > ABCDE (Transitivity)
  7. AG > ABCDEG (Increase with G)
  8. (A,B,C,D,E,G) += {A, B, C, D, E, G} to
  9. (A,x,x,x,x,G) += {A, B, C, D, E, G}
  10. (AG) += {A, B, C, D, E, G}

:::success { A > BCD, BC > DE, B > D, D > A }
b. Prove (using Armstrong’s axioms) that AG is a superkey.

  • A > BCD (Given)
  • A > ABCD ( Augmentation with A)
  • BC > DE (Given)
  • ABCD > ABCDE (Augmentation with ABCD)
  • A > ABCDE (Transitivity, A > ABCD > ABCDE)
  • AG > ABCDEG (Augmentation with G) :::

c. Compute a canonical cover for this set of functional dependencies F;
give each step of your derivation with an explanation.

  1. F = {
  2. A BCD = A > BC, A > D
  3. BC DE = BC > D, BC > E
  4. B D
  5. D A
  6. }
  7. 1. "SPLIT"
  8. 2. Remove Extraneous Attributes
  9. 3. Remove Redundant FD
  10. -- D is irrelevant in step 1 and 2.
  11. Removing these two, new set of rules are identified
  12. -- Remove D in dep1 and dep2
  13. F = {
  14. A > BC, A > D, BC > D, BC > E, B > D, D > A
  15. A > D > A, BC > D > A > BC (Delete D)
  16. A > BC, BC > E, B > D, D > A
  17. B > D > A > BC > E (Transitivity Rule )
  18. A > BC, [B > E, B > D], D > A
  19. A > BC, B > DE, D > A
  20. }

In this case, no attribute is extraneous in any FD.

:::success R = { A, B, C, D, E, G }
{ A > BCD, BC > DE, B > D, D > A }
c. Compute a canonical cover for this set of functional dependencies F;
give each step of your derivation with an explanation.
Ans:
We see that D is extraneous in dep. 1 ( A > BCD ) and 2 ( BC > DE ), because of dep. 3 ( B > D ).
Removing these two, we get the new set of rules:

  • A > BC
  • BC > E
  • B > D
  • D > A

Now notice that B+ is ABCDE, and in particular, the FD ( B > E ) can be determined from this set.
Thus, the attribute C is extraneous in third dependency (B > E & BC > E => Delete C).
Removing this attribute C, and combining with the third FD ( B > D & BC > E ), we get the final canonical cover as:

  • A > BC
  • B > DE
  • D > A

Here, no attribute is extraneous in any FD. :::

d. Give a 3NF decomposition of the given schema based on a canonical cover.
Ans:
There is no canonical cover referring to the attribute set which is a subset of any other FD within the canonical cover.
Hence every FD equates their own relation.

  • R1 (A, B, C) “A > BC”
  • R2 (B, D, E) “B > DE”
  • R3 (D, A) “D > A”

The attribute G is independent to any other attribute resulting in being the part of every superkey.
Moverover no relations in the above schema contain an G and therefore
assume that none of them are superkey, so

  • R4 (A, G)

:::success R = { A, B, C, D, E, G }
{ A > BCD, BC > DE, B > D, D > A } => { A > BC, B > DE, D > A }
d. Give a 3NF decomposition of the given schema based on a canonical cover.
Ans:
We see that there is no FD in the canonical cover such that the set of attributes is a subset of any other FD in the canonical cover.
Thus, each FD gives rise to its own relation, giving

  • R1 (A, B, C)
  • R2 (B, D, E)
  • R3 (D, A)

Now, the attribute G is not dependent on any attribute.
Thus, it must be a part of every superkey.
Also, none of the above schemas have G, and hence, none of them have a superkey.
Thus, we need to add a new relation with a superkey.

  • R4 (A, G)

Finally, 3NF decomposition is

  • R1 (A, B, C)
  • R2 (B, D, E)
  • R3 (D, A)
  • R4 (A, G) :::

e. Give a BCNF decomposition of the given schema using the original set F of functional dependencies.

  1. R = {A, B, C, D, E, G}
  2. F = {
  3. A BCD
  4. BC DE
  5. B D
  6. D A
  7. }
  8. (A, B, C, D, E, G) += {A, B, C, D, E, G}
  9. (A, G) += {A, B, C, D, E, G}
  10. (A, G are candidate keys)
  11. PRIME ATTRIBUTE = {A,G}
  12. NOT IN BCNF
  13. - BC > DE
  14. - B > D
  15. - D > A
  16. (alpha U beta) = {A, B, C, D, E}
  17. R - (beta - alpha)
  18. = {A, B, C, D, E, G} - ( {D, E, A} - {B, C, D})
  19. = {x, B, C, D, x, G}
  20. = {B, C, D, G}

:::success R = { A, B, C, D, E, G }
{ A > BCD, BC > DE, B > D, D > A } => { A > BC, B > DE, D > A }
e. Give a BCNF decomposition of the given schema using the original set F of functional dependencies.
Ans:
We start with R (A, B, C, D, E, G)
We see that the relation is not in BCNF because of the first FD (A > BCD).
Hence, we decompose it accordingly to get

  • R1 (A, B, C, D)
  • R2 (A, E, G)

Now, we notice that A > E is an FD (A > BC > DE) in F+ and causes R2 to violate BCNF.
Once again, decomposing R2 gives

  • R1 (A, B, C, D)
  • R2 (A, G)
  • R3 (A, E)

This schema is now in BCNF :::


From Tutorial

  1. F = {
  2. A > BCD => ( A > B, A > C, A > D )
  3. BC > DE
  4. B > D
  5. D > A
  6. }
  7. R = {A B C D E G}
  8. check:
  9. A B C D E G +=
  10. (AG) += A B C D E G
  11. A += A B C D E
  12. G += G
  13. ( ABCDEG - ABCD ) U ( ABCD - BCD ) U ( ABCD )
  14. ( EG ) U ( A ) U ( ABCD )
  15. ( AEG ) U ( ABCD )
  16. A > E
  17. ( AEG - AE ) U ( AE - E ) U ( AE )
  18. ( G ) U ( A ) U ( AE )
  19. ( AG ) U ( AE )
  20. ( ABCD ) U ( AG ) U ( AE )
  21. AG += ABCDEG PRIME ATTRIBUTES (A, G, D, B)
  22. A += ABCDE
  23. G += G
  24. DG += DGABCE (Super Key)
  25. D += ABCDE
  26. G += G
  27. BG += BGDACE
  28. B += ABCDE
  29. G += G