relational-databaserelationrelational-algebrafunctional-dependenciescandidate-key

Finding the Candidate Keys of a Relation Using the FD's


I have definitely checked out many different related posts, as suggested when creating this question. I have also done different sample problems from online sources as well from a similar problem. However, I am stuck on the problem below specifically.

Given the following relation R and the set of functional dependencies S that hold on R, find all candidate keys for R. Show your work.

R(A, B, C, D, E, F)
S:
AB → C

AC → B

AD → E

BC → A

E → F

Initially, I broke the attributes into groups: attributes found only on the left, only on the right, and on both sides (they are D, ABCE, and F respectively). I also know that I should try to compute the closure of D. This is where I get stuck. At first glance, this seems like I am unable to solve this problem, which isn't true. I also tried computing the closures of (AD), (BD), (CD), and (ED) because I thought that the closure of D = D. Any thoughts?


Solution

  • The keys here are ABD, ACD and BCD.

    You were on the right track. After dividing the attributes in three groups, the attributes under "only on the left" list are always a part of the key. Here that attribute is D.

    "I also tried computing the closures of (AD), (BD), (CD), and (ED)"

    As you couldn't determine the key while taking attributes in groups of 2 you should have then tried making group of 3 attributes and check their closure.