Attribute Closure (X⁺)
๐ Attribute Closure (X⁺)
๐น Definition
For a set of attributes X, the closure of X (denoted X⁺) is:
The set of all attributes that can be functionally determined from X using the given functional dependencies (F).
Why Closure is Important
Attribute closure helps us:
- ✅ Find all attributes determined by X
- ✅ Check if X is a superkey / candidate key
- ✅ Understand hidden relationships
- ✅ Perform normalization
⚙️ Algorithm : Finding X⁺
๐ Input:
- Set of FDs → F
- Set of attributes → X
๐ Steps of the Algorithm
๐ก Key Idea
- Start with what you know (X)
- Keep adding attributes that can be derived
- Stop when nothing new can be added
๐งพ Given Example: CLASS Relation
Relation:
๐ Functional Dependencies (F)
-
FD1:
-
FD2:
-
FD3:
-
FD4:
-
FD5:
๐ Closure Calculations
๐น 1. Closure of {Classid}⁺
Step-by-step:
-
Start:
-
Apply FD1:
✅ Result:
๐ฏ Interpretation:
- Classid determines all attributes
- ๐ So, Classid is a candidate key
๐น 2. Closure of {Course#}⁺
Step-by-step:
-
Start:
-
Apply FD2:
✅ Result:
๐ฏ Interpretation:
- Course# determines only Credit hours
- ❌ Not a key
- ❌ Cannot determine instructor, text, etc.
๐น 3. Closure of {Course#, Instr_name}⁺
Step-by-step:
-
Start:
-
Apply FD3:
-
Apply FD4:
-
Apply FD5:
-
Apply FD2:
✅ Final Result:
๐ฏ Interpretation:
- Determines many attributes
- ❌ But does NOT determine Classid
๐ Therefore:
- ❌ Not a candidate key
Key Takeaways
- Closure (X⁺) = all attributes determined by X
- Use algorithm iteratively
-
Helps identify:
- Candidate keys
- Redundant attributes
- Interpretation gives real-world meaning
Comments
Post a Comment