❖ Normalisation |
Normalisation: branch of relational theory providing design insights.
The goals of normalisation:
Normalisation draws heavily on the theory of functional dependencies.
Normalisation algorithms reduce the amount of redundancy in a schema
❖ Normal Forms |
Normalisation theory defines six normal forms (NFs).
We say that "a schema is in xNF", which ...
1NF allows most redundancy; 5NF allows least redundancy.
For most practical purposes, BCNF (or 3NF) are acceptable NFs.
❖ Normal Forms (cont) |
all attributes have atomic values we assume this as part of relational model, so every relation schema is in 1NF |
||
all non-key attributes fully depend on key (i.e. no partial dependencies) avoids much redundancy |
||
BCNF |
no attributes dependent on non-key attrs (i.e. no transitive dependencies) avoids most remaining redundancy |
❖ Normal Forms (cont) |
In practice, BCNF and 3NF are the most important.
Boyce-Codd Normal Form (BCNF):
❖ Boyce-Codd Normal Form |
A relation schema R is in BCNF w.r.t a set F of functional dependencies iff:
for all fds X → Y in F+
Observations:
❖ Boyce-Codd Normal Form (cont) |
If we transform a schema into BCNF, we are guaranteed:
This may be a problem if the fds contain significant semantic information about the problem domain (use 3NF to preserve dependencies)
A dependency A → C is not preserved if, e.g.
❖ Boyce-Codd Normal Form (cont) |
Example: schema in BCNF
R = ABCD, F = { A → B, A → C, A → D }
key(R) = A, all fds have key on RHS
Example: schema not in BCNF
R = ABCD, F = { A → BCD, D → B, BC → AD }
if key(R) = A, D → B does not have key on LHS
if key(R) = BC, D → B does not have key on LHS
❖ Third Normal Form |
A relation schema R is in 3NF w.r.t a set F of functional dependencies iff:
for all fds X → Y in F+
The extra condition represents a slight weakening of BCNF requirements.
❖ Third Normal Form (cont) |
If we transform a schema into 3NF, we are guaranteed:
Whether to use BCNF or 3NF depends on overall design considerations.
❖ Third Normal Form (cont) |
Example: schema in 3NF
R = ABCDE, F = { B → ACDE, E → B }
key(R) = B, in E → B, E is not a key, but B is
Example: schema not in 3NF
R = ABCDE, F = { B → ACDE, E → D }
key(R) = B, in E → D, E is not a key, neither is D
Produced: 5 Nov 2020