Normal Forms

COMP3311 20T3 ♢ Normal Forms ♢ [0/10]
❖ 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

COMP3311 20T3 ♢ Normal Forms ♢ [1/10]
❖ 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.

COMP3311 20T3 ♢ Normal Forms ♢ [2/10]
❖ Normal Forms (cont)


1NF all attributes have atomic values
we assume this as part of relational model,
so every relation schema is in 1NF
2NF all non-key attributes fully depend on key
(i.e. no partial dependencies)
avoids much redundancy
3NF
BCNF
no attributes dependent on non-key attrs
(i.e. no transitive dependencies)
avoids most remaining redundancy

COMP3311 20T3 ♢ Normal Forms ♢ [3/10]
❖ Normal Forms (cont)

In practice, BCNF and 3NF are the most important.


Boyce-Codd Normal Form (BCNF):


Third Normal Form (3NF):
COMP3311 20T3 ♢ Normal Forms ♢ [4/10]
❖ 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+


A DB schema is in BCNF if all of its relation schemas are in BCNF.

Observations:

COMP3311 20T3 ♢ Normal Forms ♢ [5/10]
❖ Boyce-Codd Normal Form (cont)

If we transform a schema into BCNF, we are guaranteed:

However, we are not 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.

COMP3311 20T3 ♢ Normal Forms ♢ [6/10]
❖ 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

COMP3311 20T3 ♢ Normal Forms ♢ [7/10]
❖ 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+

A DB schema is in 3NF if all relation schemas are in 3NF.

The extra condition represents a slight weakening of BCNF requirements.

COMP3311 20T3 ♢ Normal Forms ♢ [8/10]
❖ Third Normal Form (cont)


If we transform a schema into 3NF, we are guaranteed:

However, we are not guaranteed:

Whether to use BCNF or 3NF depends on overall design considerations.

COMP3311 20T3 ♢ Normal Forms ♢ [9/10]
❖ 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

COMP3311 20T3 ♢ Normal Forms ♢ [10/10]


Produced: 5 Nov 2020