0
0
DBMS Theoryknowledge~10 mins

Closure of attributes in DBMS Theory - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Closure of attributes
Start with attribute set S
Find all FDs where LHS is subset of S
Add RHS attributes of these FDs to S
Check if S changed
Repeat process
Return S+
Start with a set of attributes, repeatedly add attributes implied by functional dependencies until no new attributes can be added.
Execution Sample
DBMS Theory
S = {A}
repeat:
  for each FD X->Y:
    if X subset of S:
      S = S union Y
until no change
This code finds the closure of attribute set S under given functional dependencies.
Analysis Table
StepCurrent Closure SFDs AppliedNew Attributes AddedChanged?
1{A}A->B{B}Yes
2{A,B}B->C{C}Yes
3{A,B,C}C->D{D}Yes
4{A,B,C,D}No FD applies{}No
💡 No new attributes added in step 4, closure is complete.
State Tracker
VariableStartAfter 1After 2After 3Final
S{A}{A,B}{A,B,C}{A,B,C,D}{A,B,C,D}
Key Insights - 2 Insights
Why do we keep repeating the process until no change?
Because each step may add new attributes that enable applying more functional dependencies, as shown in execution_table steps 1 to 4.
Can closure include attributes not originally in the set?
Yes, closure adds attributes implied by functional dependencies, like B, C, D added to initial {A} in execution_table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the closure S after step 2?
A{A,B}
B{A,B,C}
C{A,B,C,D}
D{A}
💡 Hint
Check the 'Current Closure S' column at step 2 in execution_table.
At which step does the closure stop changing?
AStep 2
BStep 3
CStep 4
DStep 1
💡 Hint
Look at the 'Changed?' column in execution_table to find when it becomes 'No'.
If the FD C->D was missing, what would be the closure after step 3?
A{A,B,C,D}
B{A,B,C}
C{A,B}
D{A}
💡 Hint
Refer to variable_tracker and consider that without C->D, D won't be added.
Concept Snapshot
Closure of attributes:
- Start with attribute set S
- Add attributes from FDs where LHS ⊆ S
- Repeat until no new attributes added
- Result is S+, the closure
- Used to find all attributes functionally determined by S
Full Transcript
Closure of attributes means starting with a set of attributes and repeatedly adding attributes that are implied by functional dependencies until no more can be added. For example, starting with {A}, if A->B, add B; then if B->C, add C; and so on. This process stops when no new attributes can be added. The final set is called the closure of the original attributes. This helps understand what attributes can be determined from a given set in a database.