Candidate Keys via Functional Dependencies (Attribute Closure)

Candidate Keys via Functional Dependencies (Attribute Closure)

Verified Sources
Sep 12, 2026

We’re given a relation R(A,B,C,D,E)R(A,B,C,D,E) with functional dependencies (FDs): ABCA \rightarrow BC, CDECD \rightarrow E, and BDB \rightarrow D. Our goal is to find candidate keys—minimal attribute sets whose attribute closure equals all attributes of the relation, i.e., X+={A,B,C,D,E}X^+ = \{A,B,C,D,E\}. 2

Key learning terms: attribute closure functional dependency candidate key minimality superkey

Footnotes

  1. Attribute closure - Wikipedia - Definition and method for computing X+X^+ from FDs.

  2. Candidate key - Wikipedia - Defines candidate keys and their relation to closures/superkeys.

Attribute Closure & Candidate Keys (Functional Dependencies)

Strategy

  1. Compute X+X^+ for relevant starting sets XX using the FDs.
  2. Identify which XX are superkeys (X+={A,B,C,D,E}X^+ = \{A,B,C,D,E\}).
  3. Enforce minimality (remove any attribute and re-check; if closure still gives all attributes, it wasn’t minimal). 2

Below, we use A+A^+, B+B^+, C+C^+, D+D^+, and E+E^+-style reasoning plus combinations, focusing on reachability via the dependency graph implied by the FDs.

Footnotes

  1. Candidate key - Wikipedia - Defines candidate keys and their relation to closures/superkeys.

  2. Functional dependency - Wikipedia - Background on FDs used to infer attributes and compute closures.

Compute Candidate Keys by Attribute Closure

  1. 1
    Step 1

    Use ABCA \rightarrow BC, BDB \rightarrow D, and CDECD \rightarrow E.

  2. 2
    Step 2

    From AA, derive BB and CC using ABCA \rightarrow BC.

  3. 3
    Step 3

    Once BB is in the closure, add DD using BDB \rightarrow D.

  4. 4
    Step 4

    With both CC and DD available, derive EE using CDECD \rightarrow E.

  5. 5
    Step 5

    Check if the closure equals all attributes: obreakA,B,C,D,E obreak{A,B,C,D,E}.

  6. 6
    Step 6

    Try proper subsets of {A}\{A\} (none exist except empty set), so minimality holds if AA is a superkey.

  7. 7
    Step 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 AA

Start: A+={A}A^+ = \{A\}.

  • Using ABCA \rightarrow BC: add BB and CC
    A+={A,B,C}A^+ = \{A,B,C\}
  • Now BDB \rightarrow D: add DD
    A+={A,B,C,D}A^+ = \{A,B,C,D\}
  • Now CDECD \rightarrow E: since CC and DD are present, add EE
    A+={A,B,C,D,E}A^+ = \{A,B,C,D,E\}

So, AA is a superkey.

Minimality check for AA

The only proper subset of {A}\{A\} is the empty set, which cannot derive any of A,B,C,D,EA,B,C,D,E from the given FDs. Therefore, AA is minimal, hence a candidate key.

Candidate key candidate: {A}\boxed{\{A\}}

2) Rule out other candidate keys

To ensure there are no other candidate keys, we must see whether any other attribute set XX can derive AA (since every candidate key must determine all attributes including AA). But note:

  • None of the FDs have AA on the right-hand side.
  • Therefore, no attribute other than AA can produce AA via these FDs.

Thus, any superkey XX must already contain AA. Otherwise, AX+A \notin X^+, so X+X^+ cannot equal all attributes.

So any candidate key must be of the form X{A}X \supseteq \{A\}. But we already found that {A}\{A\} 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, AA 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 1

Use repeated application of XYX \rightarrow Y rules to build X+X^+."

Check superkey condition

Step 2

Verify X+={A,B,C,D,E}X^+ = \{A,B,C,D,E\}."

Enforce minimality

Step 3

Confirm no proper subset of XX is also a superkey."

Eliminate impossible keys

Step 4

If AA cannot be derived from others, any candidate key must contain AA."

Closure Reachability Summary (Key Seeds)

Whether the seed’s closure reaches all attributes {A,B,C,D,E}\{A,B,C,D,E\}.

Common Questions

Candidate Key Mastery (FDs)

1 / 4
Question · Term

What is attribute closure $X^+$?

Click to reveal
Answer · Definition

The set of all attributes that can be inferred from X using the given FDs (by repeated application).

Knowledge Check

Question 1 of 4
Q1Single choice

Which set is a candidate key for R(A,B,C,D,E)R(A,B,C,D,E) given ABCA \rightarrow BC, CDECD \rightarrow E, and BDB \rightarrow D?