Logo
Published on

Closure of Attribute Sets in DBMS – Definition, Steps, and Example

In relational database design, the closure of an attribute set is a fundamental concept used to determine all attributes that can be functionally derived from a given set using known functional dependencies. This helps verify candidate keys, enforce data integrity, and apply normalization rules effectively.

📌 What is Closure of an Attribute Set?

The closure of a set of attributes X, denoted as X⁺, is the set of all attributes that can be functionally determined from X using a given set of functional dependencies (FDs).

✍️ Steps to Find Closure (X⁺)

To compute X⁺:

  1. Start with X Add all attributes from X into the closure set.
  2. Apply Functional Dependencies For each FD A → B, if A ⊆ X⁺, add B to X⁺.
  3. Repeat Until Stable Continue applying FDs until no new attributes can be added.
  4. Result The final X⁺ includes all attributes functionally dependent on X.

📘 Example: Closure of {Student\_ID}

Let's use a table called Student_Course with the following attributes and FDs:

Student_IDCourse_IDInstructorDepartment
101C101Dr. SmithScience
102C102Dr. BrownArts
103C103Dr. LeeCommerce

Functional Dependencies:

  • Student_ID → Course_ID
  • Course_ID → Instructor
  • Instructor → Department

Calculate: {Student\_ID}⁺

Start with: Closure = {Student_ID}

Apply:

  • Student_ID → Course_ID → {Student_ID, Course_ID}
  • Course_ID → Instructor → {Student_ID, Course_ID, Instructor}
  • Instructor → Department → {Student_ID, Course_ID, Instructor, Department}

Result: {Student\_ID}⁺ = {Student\_ID, Course\_ID, Instructor, Department}

This means Student_ID can functionally determine all attributes in the table — thus, it's a candidate key.

💡 Why Attribute Closure is Important

PurposeDescription
Identify Candidate KeysIf X⁺ includes all attributes, X is a super/candidate key.
Normalize TablesHelps detect and eliminate transitive or partial dependencies.
Verify Functional DependenciesEnsures existing FDs are logically valid and don't violate integrity rules.
Prevent RedundancyGuides in organizing data efficiently by understanding dependencies.

✅ Conclusion

Understanding how to find the closure of attribute sets is a crucial skill for database designers. It not only helps validate functional dependencies and candidate keys, but also plays a central role in normalization to avoid redundancy and ensure data consistency.

Would you like to explore how to find all candidate keys from a given FD set? Let me know, and I'll walk you through it.