You are on page 1of 4

Finding Minimal Cover

Split up the dependencies with multiple right sides

Check for redundant determinant attributes

X->Y,Z becomes X->Y, X-> Z

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.

Check for redundant dependencies

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:

T4a. Prof, Semester, Time -> Room


so T5 is redundant.
Result so far:
T1. Student, Course, Semester -> Prof
T2. Prof, Semester -> Course
T3. Course, Semester, Time -> Prof
T4a. Prof, Semester, Time -> Room
Step 3: Remove Redundant Dependencies
For T2 and T4a, Course and Room cannot be derived from anywhere else, so they are not redundant.
For T1:
Remove T1 from the set of dependencies
Compute {Student, Course, Semester}+ using only T2, T3, and T4a
No determinant in the rest of the functional dependencies match these attributes, so
the closure is simply {Student, Course, Semester}
Because Professor was not in the closure, T1 is not redundant
(Similar reasoning for T3)

Create 3NF from Minimal Cover

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)

Another Way to Create 3NF from Minimal Cover

Find minimal cover of FDs


Every FD has one attribute on right
No FD can be derived from other FDs in the set
Combine FDs with same attributes on the left
Create a relation for each remaining FD
If no relation contains the original superkey for all attributes, construct one relation with just
the superkey
This set is guaranteed to be 3NF and equivalent to the original relation

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 }

You might also like