# Relation candidate keys

I have the following relation:

``````R = ABCDE
F: AB->DE, AC->B, DE->C, AE->C, C->AB
``````

I need to determine this relations candidate keys.

Now, if I understood the defintion correctly:

In the relational model of databases, a candidate key of a relation is a minimal superkey for that relation; that is, a set of attributes such that the relation does not have two distinct tuples

The candidate keys would be: C, AB, AE, DE.

Is this correct or are there more?

• I think it's correct. – ypercubeᵀᴹ Dec 2 '12 at 21:57
• Always nice to say it's your homework so that we can help you a bit more and explain. – Philᵀᴹ Dec 3 '12 at 1:31
• Correct. (But my comment is too short.) – Mike Sherrill 'Cat Recall' Dec 3 '12 at 2:15
• Why wouldn't the key for example be ABD? – Tool Dec 3 '12 at 22:02

## 1 Answer

A superkey (and therefore a candidate key) that does not contain all attributes must contain at least an attribute set that is the left side of a functional dependency. Otherwise it would not be possible to generate an additional attribute from the attribute set of this superkey and this contradicts the definition of a superkey.

But a subset of ABCDE containing at least one of C,AB,AE or DE is already a superkey and to be minimal it is necessary that it contains only one of these subsets.

So the only subsets that must me investigated are that that are supersets of AC. But a superset of AC cannot be a minimal superkey because C already is a key.

Therefore the only candidate keys are C,AB,AE and DE