Database Design - Normalization
Database Design - Normalization
NORMALIZATION
Benefits of Normalization
• Less storage space • Clearer data relationships
• Quicker updates • Easier to add data
• Less data inconsistency • Flexible Structure
There are a couple of things you need to check before you start the Normalization
process.
1. Each table must have a Primary Key.
2. A table cannot contain repeating groups of data.
2NF
Note that the transitive dependency and calculated field have migrated to the table
Order-details
Remove the calculated field from the table from the table.
The table describes two different subjects because it has the transitivity
dependency Order-Details and Products.
3NF
A relation schema R is in the third normal form if and only if it is in 2NF and
every non-key attribute is non-transitively dependent on the Primary Key.
As the definition states, a table must already be in Second Normal Form before
you can apply Third Normal Form. If this is the case, you then apply Third
Normal Form to ensure that the table has the following characteristics:
a. Each field value is independently updateable ( non_transitivity); changing
the value for one field in a given record does not adversely affect the
value of any other field in that record.
b. Each field identifies a specific characteristic of the table's subject.
c. Each non-key field in the table is functionally dependent upon the entire
Primary Key.
d. The table describes one and only one subject.
BCNF was proposed as a simpler form of 3NF, but it was found to be stricter than
3NF, because every relation in BCNF is also in 3NF. However a relation in 3NF is
not necessarily in BCNF.
4NF
A relation schema R is in the fourth normal form if and only if, whenever there
exist subsets A and B of the attributes of R such that the (nontrivial) MVD
AB is satisfied, then all attributes of R are also functionally dependent on A.
The purpose of 4NF is to ensure that a table does not contain any multi-valued
dependencies, and that it describes one and only one subject.
Example – 4NF
The table EmployeeInformation contains two multivalued dependencies
- EmployeeID Language
( Table 1 : EmployeeLanguages )
- EmployeeID DeveloperCertification
( Table 2 : EmployeeCertificates)
5NF
A relation schema R is in the fifth normal form – also called Projection / Join
Normal Form (PJ/NF) – if and only if every non-trivial join dependency that holds
for R is implied by the Candidate Keys of R.
A join dependency exists for a given table if the table and all of its original records
can be reconstructed by an SQL JOIN operation that reunites all tables created by
its decomposition.
If you suspect that you can (or should) decompose the table check the following.
1. Can the new table(s) using the Primary Key or a Candidate Key as part of
the new table structure?
2. Can recreation of the original table by using an SQL JOIN operation that
reunites all of the tables recreated by the decomposition?
3. Will any records will be lost in the process of decomposing the
table?
*******************