-1

I have trouble finding the candidate keys of a relation when there aren't any keys with only 1 attribute, so I have to find composite candidate keys.

I have the relation R(A, B, C, D, E, F, G, H, I, J, K) and the FDs:

A, B → D

A → C, E

B→ G

G → H, I

C → J, K

and I have to find the key of R, but there aren't any keys with 1 attribute. In order to find all the candidate keys of R I calculate every combination of 2 fields or I just check if the combination {A, B} is a candidate key, because there is a FD with that combination?

Thanks in advance

philipxy
  • 14,867
  • 6
  • 39
  • 83
  • You seem confused & your justifications don't make sense. Edit a definition of CK into your post; then show all the steps you took to find all the CKs. PS You say "I have the [following] FDs" but that is not enough to find the CKs--which you will see when you look for all CKs via the definition and/or a published algorithm--we need to know enough to determine *all* FDs that hold. So you need to know that that list is a *cover*. PS "I calculate every combination of 2 fields" is confused-- a composite CK has 2 or more attributes. (That sentence is also unclear.) (So is your first sentence.) – philipxy Jan 11 '19 at 03:20
  • 1
    Google “how to find candidate keys” and you will find a lot of materials. – Renzo Jan 11 '19 at 04:58

1 Answers1

0

Any attribute that does not appear on the right side of any FD must be part of all keys. In your example, those attributes are A, B and F. Compute the closure of { A, B, F }. If it covers R (and it does), that set is the sole (candidate) key of R.

Jon Heggland
  • 274
  • 1
  • 7