DBMS Topics
Closure of Attributes
Last Updated : 21 May, 2026
The closure of a set of attributes X denoted X⁺ under a set of functional dependencies F is the set of ALL attributes that are functionally determined by X.
Definition
The closure of a set of attributes X (denoted X⁺) under a set of functional dependencies F is the set of ALL attributes that are functionally determined by X.
Algorithm
| Input | Attribute set X, FD set F |
| Output | X⁺ (closure of X) |
| FOR each FD (LHS | RHS) in F DO |
Applications of Attribute Closure
1. Check if X is a Superkey
X is a superkey if X⁺ contains all attributes of R.
2. Find All Candidate Keys
A candidate key is a minimal superkey.
3. Check if an FD X → Y Holds
X → Y holds if and only if Y ⊆ X⁺.
4. Find Canonical Cover
Used to eliminate redundant FDs and redundant attributes from FD left-hand sides.
Detailed Worked Examples
Example 1 — Basic Closure
| F = { A | BC, CD → E, B → D, E → A } |
| Step 0 | result = {A, E} |
| A | BC → result = {A, B, C, E} |
| E | A → A already present |
| B | D → result = {A, B, C, D, E} |
| CD | E → E already present |
| (AE)⁺ = {A, B, C, D, E} | AE is a superkey |
| A⁺: {A} | A→BC → {A,B,C} → B→D → {A,B,C,D} → CD→E → {A,B,C,D,E} |
| A⁺ = {A,B,C,D,E} | A alone is a superkey! |
Example 2 — Finding All Candidate Keys
| F = { PQ | R, R → S, S → P } |
| P⁺: {P} — no FD starts with P alone | P⁺ = {P} ✗ not superkey |
| Q⁺: {Q} — no FD starts with Q alone | Q⁺ = {Q} ✗ |
| R⁺: {R} | R→S → {R,S} → S→P → {P,R,S} ✗ (Q missing) |
| S⁺: {S} | S→P → {P,S} ✗ |
| (PQ)⁺: {P,Q} | PQ→R → {P,Q,R} → R→S → {P,Q,R,S} ✓ SUPERKEY |
| Check subsets P⁺={P} ✗, Q⁺={Q} ✗ | PQ is a CANDIDATE KEY |
| (QR)⁺: {Q,R} | R→S → {Q,R,S} → S→P → {P,Q,R,S} ✓ SUPERKEY |
| Check Q⁺={Q} ✗, R⁺={P,R,S} ✗ | QR is a CANDIDATE KEY |
| (QS)⁺: {Q,S} | S→P → {P,Q,S} → no more → {P,Q,S} ✗ |
| Candidate Keys | {PQ}, {QR} |
Example 3 — Verifying an FD
| F = { A | B, B → C, C → D } |
| Q: Does A | D hold (i.e., is A → D in F⁺)? |
| {A} | A→B → {A,B} → B→C → {A,B,C} → C→D → {A,B,C,D} |
| D ∈ A⁺? YES | A → D holds ✓ |
Summary Table
| Use Case | How to Use Closure |
|---|---|
| Is X a superkey? | X⁺ = all attributes? |
| Is X → Y derivable? | Y ⊆ X⁺? |
| Find candidate keys | Find minimal X where X⁺ = all attributes |
| Check FD redundancy | Remove FD, recheck if closure is same |
| Check attribute redundancy | Remove attribute from LHS, recheck closure |
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Closure of Attributes.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, closure, attributes, closure of attributes
Related DBMS Topics