CS457 Syllabus & Progress

### Finding the closure set X+: an abstract example

• An abstract example of finding X+

• The database design theory using functional dependencies (i.e., the theory of normal forms ) does not use semantical informations

In other words, the method must work with abstract attribute names

• Example:

 ``` R(A, B, C, D, E, F) ℉ = { A → BC BD → EF F → A } ```

• Computing A+:

 ``` Initialize: A+ := A; For every FP in ℉ do: 1. A → BC ---> A+ := A,B,C DONE = FALSE; 2. BD → EF ---> no change 3. F → A ---> no change Result at end of loop: A+ := A,B,C There were changes, so loop again... For every FP in ℉ do: 1. A → BC ---> no change 2. BD → EF ---> no change 3. F → A ---> no change Result at end of loop: A+ = A,B,C There were NO changes, so DONE A+ = A,B,C ```

• Computing BD+:

 ``` Initialize: BD+ := BD; For every FP in ℉ do: 1. A → BC ---> no change 2. BD → EF ---> BD+ := B,D,E,F DONE = FALSE; 3. F → A ---> BD+ := A,B,D,E,F DONE = FALSE; Result at end of loop: BD+ := A,B,D,E,F There were changes, so loop again... For every FP in ℉ do: 1. A → BC ---> BD+ := A,B,C,D,E,F DONE = FALSE; 2. BD → EF ---> no change 3. F → A ---> no change Result at end of loop: BD+ := A,B,C,D,E,F There were changes, so loop again... For every FP in ℉ do: 1. A → BC ---> no change 2. BD → EF ---> no change 3. F → A ---> no change Result at end of loop: BD+ = A,B,C,D,E,F There were NO changes, so DONE BD+ = A,B,C,D,E,F ```

• NOTE: : BD is a superkey

• We can easily determine that BD satisfies the minimality property:

 B+ = {B} D+ = {D}

So BD is a key

• Computing AD+:

 ``` Initialize: AD+ := AD; For every FP in ℉ do: 1. A → BC ---> AD+ := A,B,C,D DONE = FALSE; 2. BD → EF ---> BD+ := A,B,C,D,E,F DONE = FALSE; 3. F → A ---> no change Result at end of loop: AD+ := A,B,C,D,E,F For every FP in ℉ do: 1. A → BC ---> no change 2. BD → EF ---> no change 3. F → A ---> no change Result at end of loop: AD+ = A,B,C,D,E,F There were NO changes, so Done AD+ = A,B,C,D,E,F ```

• NOTE:

• AD is a superkey

Because:

 AD+ = R (entire relation) !!!

• We can also determine that AD satisfies the minimality property by computing:

• A+:

 ``` A+ = A = A B C ```

• D+:

 ``` D+ = D = D (end) ```

Therefore:

 AD is minimal !!!!

So: AD is also a key