I got relation:

R = { (ABCDEF) , (A B F -> C, B C -> F, F -> A, F -> B, D E -> E, E -> D)}

keys of this relation are:

{BCE}, {EF}

But I don't get it... why? Why not only {EF}.. it got less attributes than {BCE}..

Another example, relation:

R2 = {(ABCDEF), (A -> B C , B -> D , E -> F)}

and the key is:


why only one? Why not:

{AE}, {ABE}

ABE also determines all other attributes, why is it not a key?

  • 1
    In the 2nd question, ABCDEF also determines all attributes. Why not that too? Jan 19, 2014 at 17:57
  • Yea, I know it determines all atributes. And I ask myself the same question. Why not? Thats what i am asking. Maybe its the dumbest question I have ever asked.. but there it is. Jan 19, 2014 at 18:04
  • 1
    Revisit your notes about the definition of a key. See also the Wikipedia page on Superkey where what you call a key (if I understand you correctly) is referred to as a "candidate key" or "minimal superkey". The key word (sorry for the pun) is minimal. Jan 19, 2014 at 18:15
  • I understand why EF is a key (first example) - its obvious. There are no keys among 1-attribute expressions, and EF is a key among 2-attribute expressions. But why BCE is also a key? How can it be minimal if it has 3 attributes, and EF got 2... 2 < 3. Therefore BCE is not minimal. Jan 19, 2014 at 18:39
  • 3
    Minimal does not mean smallest in size (number of attributes). But smallest when compared as sets. Means it has no subset which is also a superkey. No subset of EF and no subset of BCE is a superkey, so these two are the minimal superkeys. Jan 19, 2014 at 19:08

1 Answer 1


Any relation has multiple keys present in it. The primary key is the minimal key amongst these various candidate keys which we can choose from. Candidate keys are a minimal cover of attributes which determines a tuple. We can have many many candidate keys.

The reason A,B,C,D,E,F,G is a key is since it is not a minimal cover of attributes that determine the entire tuple. In the second example, B is not part of the minimal cover since removing it from the candidate key still makes the remaining attributes a candidate key!

  • 2
    Your first sentence does not sound right - how about relations with only one attribute? Oct 7, 2016 at 21:23
  • And theory does not distinguish between primary key and alternate (candidate) keys. This (that we distinguish between the 1 PRIMARY KEY and multiple UNIQUE ones), making the primary somehow more important, is just an implementation choice (made by SQL). Oct 7, 2016 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.