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 X→Y 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:
“Our civilization has decided ... that determining the guilt or innocence of men is a thing too important to be trusted to trained men.... When it wants a library catalogued, or the solar system discovered, or any trifle of that kind, it uses up its specialists. But when it wishes anything done which is really serious, it collects twelve of the ordinary men standing round. The same thing was done, if I remember right, by the Founder of Christianity.”
—Gilbert Keith Chesterton (18741936)
“We have fought too much rhetoric and red tape to be lulled and comforted by a paid political advertisement showing a candidate tossing his grandchild in the air while a disembodied voice espouses family values in the background.”
—Bernice Weissbourd (20th century)
“McCoy: That sharks been following us ever since the surgeon died, waiting for the burial. Couldnt I have a musket to shoot it, sir?
Fletcher Christian: Take the deck, McCoy. Ill get the keys to the arms chest.
McCoy: Get two muskets, sir. Id like to shoot that shark on board.”
—Talbot Jennings (18961985)