Keys of a relation

database-designprimary-keyrelational-theory

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:

{AE}

why only one? Why not:

{AE}, {ABE}

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

Best Answer

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!