# Closure of Functional Dependency Example and Applications

## Closure of Functional Dependency Example and Applications of Closure –

Closure of a set (X+) is the set of attributes functionally determined by X.

Let S be the set of functional dependencies on relation R. Let X is set of attributes that appear on left hand side of some FD in S and we want to determine the set of all attributes that are dependent on X. Thus for each such set of attribute X, we determine the set  X+ of attributes that are functionally determined by X based on S, X+ is called closure of X under S.

#### Algorithm to find the X+ or Algorithm to find Closure of Functional Dependency is :

```X+ = X;
repeat
oldX+ := X+
for each FD Y→Z in S do
if Y is subset of X+ then
X+ : = X+ ∪ Z;
until (X+ =old X+)            /* If X+ did not change then leave loop*/
```

#### Example:

```Suppose we are given relation R with attributes A,B,C,D and FDs
A→BC
B→CD
```
```To find the Closure of all the attributes :
Let us find closure of A firstly.

(B+)    = {BCD}
(C+)    = {C}
(D+)    = {D}
(AB+)   = {ABCD}
(AC+)   = {ABCD}
(BC+)   = {BCD}
(BD+)   = {BCD}
(CD+)   = {CD}
(ABC+)  = {ABCD}
(ABD+)  = {ABCD}
(ACD+)  = {ABCD}
(BCD+)  = {BCD}
(ABCD+) = {ABCDEF}```
```Question :
Compute the closure of following set F of functional dependencies for
relation schema R = {A, B, C, D, E}.
A  → BC
CD → E
B  → D
E  → A```
```Solution :
Attribute closure of all the attributes :

(A)+    = {ABCDE}
(C)+    = {C}
(D)+    = {D}
(AB)+   = {ABCDE}
(AC)+   = {ABCDE}
(AE)+   = {ABCDE}
(BC)+   = {ABCDE}
(BD)+   = {BD}
(BE)+   = {ABCDE}
(CD)+   = {ABCDE}
(CE)+   = {ABCDE}
(DE)+   = {ABCDE}
(ABC)+  = {ABCDE}
(ABD)+  = {ABCDE}
(ABE)+  = {ABCDE}
(ACD)+  = {ABCDE}
(ACE)+  = {ABCDE}
(BCD)+  = {ABCDE}
(BDE)+  = {ABCDE}
(CDE)+  = {ABCDE}
(ABCD)+ = {ABCDE}
(ABCE)+ = {ABCDE}
(ABDE)+ = {ABCDE}
(ACDE)+ = {ABCDE}
(BCDE)+ = {ABCDE}```

### Incoming search terms:

• closure set of functional dependency
• closure of a set of functional dependency in dbms
• closure in dbms
• closure of functional dependency in dbms with example
• functional dependency example problems
• closure of fd example
• closure of set of fd in plsql
• closure set of functional dependency in hindi
• What is meant by the closure of a set of functional dependencies?
• closure of set in hindi