Candidate Key - Determining Candidate Keys

Determining Candidate Keys

The previous example only illustrates the definition of a candidate key and not how these are determined in practice. It is important to determine all superkeys, which is especially difficult if the relation represents a set of relationships rather than a set of entities. Therefore it is often useful to attempt to find any "forgotten" superkeys by also determining the functional dependencies. We can derive more superkeys by applying the following rule:

if S is a superkey and XY a functional dependency
then (S ∖ {Y}) ∪ {X} is also a superkey, where '\' is the set difference.

Consider for example the relation

Marriage (Husband, Wife, Date)

for which it will trivially hold that

{Husband, Wife, Date}

is a superkey. If we assume that a certain person can marry at most once on a given date then this implies the functional dependencies:

{Husband, Date} → Wife
{Wife, Date} → Husband

In this case, applying the above rule leads to the derivation of the superkeys {Husband, Date} and {Wife, Date} respectively.

Read more about this topic:  Candidate Key

Famous quotes containing the words determining, candidate and/or keys:

    I esteem it the happiness of this country that its settlers, whilst they were exploring their granted and natural rights and determining the power of the magistrate, were united by personal affection. Members of a church before whose searching covenant all rank was abolished, they stood in awe of each other, as religious men.
    Ralph Waldo Emerson (1803–1882)

    I have the greatest aversion to being a candidate on a ticket with a man whose record as an upright public man is to be in question—to be defended from the beginning to the end.
    Rutherford Birchard Hayes (1822–1893)

    Thou hast the keys of Paradise, O just, subtle, and mighty opium!
    Thomas De Quincey (1785–1859)