Professional Documents
Culture Documents
If determinant has more than one attribute, compute closure of each set that leaves out
one attribute. If it includes the right side, remove the extra attribute in the functional
dependency.
For each dependency, compute the closure of the determinant attributes against all the
other dependencies except the one youre testing. If you find the attribute on the right
side in the closure, you can leave that dependency out.
Example
Relation: Student, Course, Semester, Prof, Room, Time
T1. Student, Course, Semester -> Prof
T2. Prof, Semester -> Course
T3. Course, Semester, Time -> Prof
T4. Prof, Semester, Time -> Room, Course
T5. Prof, Semester, Course, Time -> Room
Step 1: Split Right Side
T4 is split:
T4a. Prof, Semester, Time -> Room
T4b. Prof, Semester, Time -> Course
Step 2: Find Redundant Attributes
T1: Student, Course, Sem -> Prof
{Student, Course}+ = {Student, Course}
{Student, Sem}+ = {Student, Sem}
{Course, Sem}+ = {Course, Sem}
Since Prof cannot be derived without all 3 attributes, T1 has no redundant attributes
T2 and T3 and T4a are similar (no redundant attributes)
T2 is T4b with Time removed; obviously Time is redundant and T4b can be removed from the set.
T5: Prof, Semester, Course, Time -> Room
{Prof, Semester, Time}+ = {Prof, Semester, Time, Course, Room}
so leave out Course, but:
Apply the BCNF algorithm using F' and the following addition:
After each decomposition identify the set of dependencies N in F' that are not preserved
by the decomposition.
For each X -> a in N create a relation Rn(X a) and add it to the decomposition
Back to Example
Given FD:
T1. Student, Course, Semester -> Prof
T2. Prof, Semester -> Course
T3. Course, Semester, Time -> Prof
T4a. Prof, Semester, Time -> Room
(Student, Course, Semester)+ = Student, Course, Semester, Prof
(Prof, Semester)+ = Prof, Semester, Course
(Course, Semester, Time) += Course, Semester, Time, Prof
(Prof, Semester, Time)+ = Prof, Semester, Time, Room
(Student, Course, Semester, Time)+ = Student, Course, Semester, Prof, Time, Room, and hence a
superkey.
None of the determinant is a superkey, so decompose (Student, Course, Prof, Semester, Room, Time).
Pick T1.
R1(Student, Course, Semester, Prof)
R2(Student, Course, Semester, Room, Time)
R1 is in BCNF, but not R2. Cant split R2 anymore and T2, T3, T4a are not preserved. So add:
R3(Prof, Semester, Course)
R4(Course, Semester, Time, Prof)
R5(Prof, Semester, Time, Room)
(based on T2)
(based on T3)
(based on T4a)
Back to Example
Each relation has all (and only) the attributes mentioned in one dependency;
R1 = { Student, Course, Semester, Prof }
R2 = { Prof, Semester, Course }
R3 = { Course, Semester, Time, Prof }
R4 = { Prof, Semester, Time, Room }
Since none of these contains a key for the whole relation, we add
R5 = { Student, Course, Semester, Time }