Third Normal Form
Schema
is trivial is a superkey of - Each attribute of
is contained in a candidate key of
Database schema
BCNF implies 3NF
Lossless-Join and Dependency Preserving decomposition into 3NF relation schemata always exists
Compute 3NF Decomposition
Assume
- We will need the minimal cover
function Compute3NF(R, F)
begin
Result := ∅;
G := minimal cover for F;
for each (X -> Y) ∈ G do
Result := Result ∪ {XY};
if there is no Ri ∈ Result such that
Ri contains a candidate key for R then begin
compute a candidate key K for R;
Result := Result ∪ {K};
end;
return Result;
end
- Add all FDs in minimal cover as decompositions
- Then add a candidate key decomposition if there doesn’t exists one
Correctness Theorem
Compute3NF(