|
for ( each relation R )
{
if ( R is not in 3 NF )
{
Let X → B be a violating function dependency;
Decompose R into:
(1) R1 = X+;
(2) R2 = R - R1 ∪ X;
}
}
|
I will illustrate the decomposition algorithm using an example
Employee1(SSN, Fname, LName, PNumber, PName, Hours) |
FD: SSN → FName, LName Where: SSN is not a superkey |
|
Decomposition:
Employee1(SSN, FName, LName, PNumber, PName, Hours)
/ \
/ \
R1(SSN, FName, LName) R2(SSN, PNumber, PName, Hours)
|
|
|
|
R1(SSN, FName, LName) R2(SSN, PNumber, PName, Hours) |
We verify if the decomposed relations satisfy the 3NF criteria !!!
Recall: the functional dependencies are:
SSN → FName, LName PNumber → PName SSN, PNumber → Hours |
|
|
R1(SSN, FName, LName) R21(PNumber, PName) R22(SSN, PNumber, Hours) |
Question:
|
Answer:
|
R1 = (SSN, FName, LName)
R21 = (PNumber, PName)
R22 = (SSN, PNumber, Hours)
|