Bird
Raised Fist0
DBMS Theoryknowledge~10 mins

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

Choose your learning style10 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.

Practice

(1/5)
1. What does the closure of attributes represent in database design?
easy
A. The total number of tables in a database
B. All attributes functionally determined by a given set of attributes
C. The list of all primary keys in a database
D. The count of foreign keys referencing a table

Solution

  1. Step 1: Understand the concept of closure

    The closure of a set of attributes includes all attributes that can be functionally determined from it using given dependencies.
  2. Step 2: Relate closure to database design

    This helps identify all attributes dependent on a set, useful for normalization and design.
  3. Final Answer:

    All attributes functionally determined by a given set of attributes -> Option B
  4. Quick Check:

    Closure = all functionally determined attributes [OK]
Hint: Closure means all attributes you can find from given ones [OK]
Common Mistakes:
  • Confusing closure with number of tables
  • Thinking closure lists keys only
  • Mixing closure with foreign key counts
2. Which of the following is the correct notation for the closure of attribute set A given functional dependencies F?
easy
A. A+
B. F+
C. A*
D. F*

Solution

  1. Step 1: Recall standard notation

    The closure of an attribute set A under functional dependencies F is denoted as A+.
  2. Step 2: Differentiate from other notations

    F+ denotes closure of the set of functional dependencies, not attributes. A* and F* are not standard notations here.
  3. Final Answer:

    A+ -> Option A
  4. Quick Check:

    Attribute closure = A+ notation [OK]
Hint: Closure of attributes is always written as A+ [OK]
Common Mistakes:
  • Using F+ for attribute closure
  • Confusing closure notation with star (*)
  • Mixing attribute and dependency closures
3. Given attributes A, B, C, D and functional dependencies:
A -> B, B -> C, C -> D. What is the closure of {A}?
medium
A. {A, B, C, D}
B. {A, B, C}
C. {A, B}
D. {A, D}

Solution

  1. Step 1: Start with initial set {A}

    Closure begins with {A}.
  2. Step 2: Apply functional dependencies repeatedly

    From A -> B, add B; from B -> C, add C; from C -> D, add D.
  3. Final Answer:

    {A, B, C, D} -> Option A
  4. Quick Check:

    Applying all dependencies gives full set [OK]
Hint: Keep adding attributes until no new ones appear [OK]
Common Mistakes:
  • Stopping after first dependency
  • Forgetting to add transitive dependencies
  • Confusing closure with just initial attributes
4. Identify the error in this closure calculation: Given A -> B, B -> C, and starting with {A}, the closure is calculated as {A, C}.
medium
A. Closure should be empty
B. Incorrect initial attribute set
C. Wrong functional dependencies used
D. Missed adding attribute B before C

Solution

  1. Step 1: Check closure calculation steps

    Starting with {A}, applying A -> B adds B first.
  2. Step 2: Verify transitive dependencies

    Only after B is added can B -> C add C. Skipping B is incorrect.
  3. Final Answer:

    Missed adding attribute B before C -> Option D
  4. Quick Check:

    Closure must add intermediate attributes [OK]
Hint: Add attributes step-by-step, don't skip intermediates [OK]
Common Mistakes:
  • Skipping intermediate attributes
  • Assuming direct jump to last attribute
  • Ignoring order of dependencies
5. Given attributes A, B, C, D, E and functional dependencies:
A -> BC, CD -> E, B -> D. What is the closure of {A, D}?
hard
A. {A, C, D, E}
B. {A, B, C, D}
C. {A, B, C, D, E}
D. {A, B, C, E}

Solution

  1. Step 1: Start with {A, D}

    Initial closure is {A, D}.
  2. Step 2: Apply A -> BC

    Add B and C, closure becomes {A, B, C, D}.
  3. Step 3: Apply B -> D

    D already included, no change.
  4. Step 4: Apply CD -> E

    Since C and D are in closure, add E.
  5. Final Answer:

    {A, B, C, D, E} -> Option C
  6. Quick Check:

    All attributes reachable from {A, D} included [OK]
Hint: Use all dependencies repeatedly until no new attributes [OK]
Common Mistakes:
  • Not applying CD -> E after adding C
  • Forgetting to add B and C from A
  • Stopping closure too early
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard