4.3Finding candidate keys
The idea
A candidate key is a minimal set of attributes whose closure is everything. A reliable method finds all of them.
Think of it like this: Finding the smallest team of people who together can reach everyone through their contacts.
Why it exists
GATE asks for the number of candidate keys, prime attributes, and sometimes the largest possible key set.
How it works
- Attributes that appear on no right side must be in every key.
- Attributes that appear only on right sides are in no key.
- Take the closure of the necessary attributes; if it is not everything, add attributes and test again.
- Keep going: every minimal set counts, so cyclic FDs such as A → B, B → A give several keys.
Worked example: R(A, B, C, D), F = {AB → C, C → D, D → A}.
Keys: AB, BC, BD. B is in every key; B with A, C or D reaches everything.
Now play with it
- →Try each preset in the key finder and compare the green sets.
- →Predict the keys before looking at them.
Every subset of the attributes. Green = candidate key (minimal), yellow = super key but not minimal, grey = not a key.
Method: attributes that never appear on a right side must be in every key; start with them, take the closure, and add attributes only if something is still missing.
Check yourself
R(A, B, C), F = {A → B, B → C, C → A}. How many candidate keys?
Exam notes (the dense version)
Attributes that never appear on any right side are in every key. Attributes that appear only on right sides are in no key. Start from the necessary attributes, take the closure, and add further attributes (smallest first) until the closure is everything. Do not stop at the first key: other minimal sets can exist (for example A → B, B → A gives both A and B as keys).
Previous year questions: Functional Dependencies (6)
PYQs are grouped by topic, so this is the full set for Functional Dependencies; try the ones that match this subtopic. Open all 6 on the topic page.