In relational database design, Attribute Closure is a technique used to find all attributes that can be determined from a given set of attributes using a set of functional dependencies. It is denoted by:
X^+
and is read as “the closure of X”.
Attribute closure is extremely useful for:
Finding candidate keys and super keys.
Verifying whether a functional dependency logically follows from a given set of FDs.
Supporting normalization and dependency analysis.
What is Attribute Closure?
For a relation schema and a set of functional dependencies F:
The attribute closure of X, written as:
X^+
is the set of all attributes that can be functionally determined by X using the functional dependencies in F.
In simple terms:
Start with a set of attributes
X.Repeatedly apply functional dependencies.
Add every attribute that can be derived.
Continue until no new attributes can be added.
Algorithm to Compute Attribute Closure
Given:
A set of functional dependencies
FAn attribute set
X
follow these steps:
Step 1: Initialize Closure
Start with:
X^+ = X
Step 2: Apply Functional Dependencies
For every functional dependency:
A \to B
if:
A \subseteq X^+
then add B to:
X^+
Step 3: Repeat
Keep applying dependencies until no new attributes can be added.
The final set is the attribute closure.
Example of Attribute Closure
Consider relation:
R(A, B, C, D)
with functional dependencies:
A → B
B → C
C → D
Find:
A^+
Step 1
Start with:
A+ = {A}
Step 2
Using:
A → B
add B:
A+ = {A, B}
Step 3
Using:
B → C
add C:
A+ = {A, B, C}
Step 4
Using:
C → D
add D:
A+ = {A, B, C, D}
Final Result
A+ = {A, B, C, D}
Since the closure contains all attributes of the relation, A is a super key.
Using Attribute Closure to Check Functional Dependencies
To check whether:
X \to Y
follows from a set of FDs:
Step 1
Compute:
X^+
Step 2
Check whether:
Y \subseteq X^+
If yes, the FD holds.
If no, the FD does not follow.
Attribute Closure and Keys
Super Key
If:
X^+
contains all attributes of the relation, then X is a super key.
Candidate Key
If X is a minimal super key (no attribute can be removed), then X is a candidate key.
Why Attribute Closure Matters?
Attribute closure is one of the most important tools in relational database theory because it helps in:
Finding super keys and candidate keys.
Verifying functional dependencies.
Computing canonical covers.
Performing normalization (2NF, 3NF, BCNF).
Checking dependency preservation.
For beginners, attribute closure provides a systematic way to understand how attributes depend on one another.
Summary
Attribute Closure in DBMS is the process of finding all attributes that can be functionally determined from a given attribute set using a set of functional dependencies. It is denoted as:
X^+
and is widely used for finding super keys, verifying dependencies, and supporting normalization in relational database design.