Candidate Keys via Functional Dependencies (Attribute Closure)
We’re given a relation with functional dependencies (FDs): , , and . Our goal is to find candidate keys—minimal attribute sets whose attribute closure equals all attributes of the relation, i.e., . 2
Key learning terms: attribute closure functional dependency candidate key minimality superkey
Footnotes
-
Attribute closure - Wikipedia - Definition and method for computing from FDs. ↩
-
Candidate key - Wikipedia - Defines candidate keys and their relation to closures/superkeys. ↩
Attribute Closure & Candidate Keys (Functional Dependencies)
Strategy
- Compute for relevant starting sets using the FDs.
- Identify which are superkeys ().
- Enforce minimality (remove any attribute and re-check; if closure still gives all attributes, it wasn’t minimal). 2
Below, we use , , , , and -style reasoning plus combinations, focusing on reachability via the dependency graph implied by the FDs.
Footnotes
-
Candidate key - Wikipedia - Defines candidate keys and their relation to closures/superkeys. ↩
-
Functional dependency - Wikipedia - Background on FDs used to infer attributes and compute closures. ↩
Compute Candidate Keys by Attribute Closure
- 1Step 1
Use , , and .
- 2Step 2
From , derive and using .
- 3Step 3
Once is in the closure, add using .
- 4Step 4
With both and available, derive using .
- 5Step 5
Check if the closure equals all attributes: .
- 6Step 6
Try proper subsets of (none exist except empty set), so minimality holds if is a superkey.
- 7Step 7
Compute closures for other singletons and then check key candidates formed by combining only what can reach all attributes via the given FDs; eliminate any non-minimal superkeys by checking their subsets.
1) Compute closures
Closure of
Start: .
- Using : add and
- Now : add
- Now : since and are present, add
So, is a superkey.
Minimality check for
The only proper subset of is the empty set, which cannot derive any of from the given FDs. Therefore, is minimal, hence a candidate key.
Candidate key candidate:
2) Rule out other candidate keys
To ensure there are no other candidate keys, we must see whether any other attribute set can derive (since every candidate key must determine all attributes including ). But note:
- None of the FDs have on the right-hand side.
- Therefore, no attribute other than can produce via these FDs.
Thus, any superkey must already contain . Otherwise, , so cannot equal all attributes.
So any candidate key must be of the form . But we already found that itself is a superkey, and it is minimal. Hence, no larger set can be a candidate key (they would fail minimality).
Therefore the only candidate key is: [ \boxed{{A}} ]
type="tip" title="Pro Tip: Candidate keys must “cover” the left side of missing attributes" content="If an attribute never appears on the RHS of any FD (here, never appears on any FD’s RHS), then any candidate key must include it, because you can’t derive it from other attributes."
type="warning" title="Avoid a common mistake: assuming multiple candidates exist without testing minimality" content="Even if a set becomes a superkey (its closure gives all attributes), it’s not a candidate key unless removing any attribute breaks the ability to derive all attributes."
From FDs to Candidate Keys
Compute closures
Step 1Use repeated application of rules to build ."
Check superkey condition
Step 2Verify ."
Enforce minimality
Step 3Confirm no proper subset of is also a superkey."
Eliminate impossible keys
Step 4If cannot be derived from others, any candidate key must contain ."
Closure Reachability Summary (Key Seeds)
Whether the seed’s closure reaches all attributes .
Common Questions
Candidate Key Mastery (FDs)
Knowledge Check
Which set is a candidate key for given , , and ?