You are on page 1of 2

Question #4:

Consider a relation with schema R(A, B, C, D) and


FD = {AB → C, C → D, D → A}

(a) What are all the non-trivial FDs that follow from the given FD’s?

We need to compute the closures of all 15 nonempty sets of attributes.

Single Attributes:
A+ = A
B+ = B
C+ = ACD (New dependency: C → A)
D+ = AD

Pairs of Attributes:
AB+ = ABCD (New dependency: AB → D)
AC+ = ACD (New dependency: AC → D)
AD+ = AD
BC+ = ABCD (New dependencies: BC → A and BC→D)
BD+ = ABCD (New dependencies: BD → A and BD→C)
CD+ = ACD (New dependencies: CD → A)

Triples of Attributes:
ABC+ = ABCD (New dependencies: ABC → D)
ACD+ = ACD
BCD+ = ABCD (New dependencies: BCD → A)
ABD+ = ABCD (New dependencies: ABD → C)

All the Attributes:


ABCD+ = ABCD

So, we get a total of 11 non-trivial FDs.

(b) What are all the candidate keys of R?


From the closures above, we find that AB, BC, and BD are keys, because they have
ABCD as the closure, and they are minimal.

(c) What are all the superkeys of R that are not candidate keys?
The superkeys are all those that contain one of those three candidate keys.
Thus, the superkeys are ABC, ABD, BCD, and ABCD.

1
Question #5:
Consider a relation with schema R(A, B, C, D) and
FD = {AB → C, BC → D, CD → A, AD→B}

(a) What are all the non-trivial FDs that follow from the given FD’s?

We need to compute the closures of all 15 nonempty sets of attributes.

Single Attributes:
A+ = A
B+ = B
C+ = C
D+ = D

Pairs of Attributes:
AB+ = ABCD (New dependency: AB → D)
AC+ = AC
AD+ = ADBC (New dependencies: AD → C)
BC+ = BCDA (New dependencies: BC → A)
BD+ = BD
CD+ = CDAB (New dependencies: CD → B)

Triples of Attributes:
ABC+ = ABCD (New dependency: ABC → D)
ACD+ = ACDB (New dependency: ACD → B)
BCD+ = BCDA (New dependency: BCD → A)
ABD+ = ABDC (New dependency: ABD → C)

All the Attributes:


ABCD+ = ABCD

So, we get a total of 8 non-trivial FDs.

(b) What are all the candidate keys of R?


AB, AD, BC, CD are keys, because they have ABCD as the closure, and they are
minimal.

(c) What are all the superkeys of R that are not candidate keys?
The superkeys are ABC, ACD, ABD, BCD, and ABCD.

You might also like