Candidate keys are minimal superkeys found by recomputing closure.

highlighted = computed this step

Candidate keys

A candidate key is a minimal superkey. Minimal means no smaller contained set already determines the whole relation. The compiler enumerates subsets in deterministic order, recomputes closure for each, and keeps only the minimal winners. Note: the key table is the recomputed list, not a hand-authored list.

minimal superkeys\text{minimal superkeys}

All candidate keys

The compiled key table has 1 candidate key. Note: each listed key is included only after closure reaches the full relation and minimality has been checked.

candidate keys=1\text{candidate keys}=1

FD closure, candidate keys, BCNF decomposition, and lossless-join checks are exact finite computations on tiny schemas; dependency inference beyond these traces and physical schema design tradeoffs are beyond this book - no product claims.

Candidate keyskeyclosureAABC

Superset contrast

The contrast closure also reaches size 3 for a relation of size 3, but it is not listed as a candidate key. Note: minimality removes supersets after a smaller key already works.

X+=3,R=3\left|X^+\right|=3,\quad \left|R\right|=3

FD closure, candidate keys, BCNF decomposition, and lossless-join checks are exact finite computations on tiny schemas; dependency inference beyond these traces and physical schema design tradeoffs are beyond this book - no product claims.

Superset closure: AB+=ABCroundfdaddsclosure1B->CCABC

Summary

Candidate keys are exactly the minimal attribute sets whose closures cover the whole relation. Note: this finite enumeration is suitable for tiny teaching schemas; dependency inference beyond these traces and physical design tradeoffs are deferred.

minimality matters\text{minimality matters}