Sunday, November 1, 2015

Why Normalization?

What is Normalization?

The process of organizing data to minimize redundancy is called normalization. Normalization is refinement of ER Model which improves database design, reduces redundancy of Data.  EF Codd, the inventor of the relational model, introduced the concept of normalization. There are 6 normal forms defined. A relational database table is often described as "normalized" if it is in the Third Normal Form.

Why Normalization?
  • To refine of Entity Relationship model.
  • To reduces redundancy (duplication of data).
  • To improves database design.
What are the 3 commonly used Normalization forms ?

Here we will discuss about 3 normal forms with simple examples for before and after normal forms.

First Normal form: A table is in first normal form only when it contains non repeating groups of fields.
The Student table in this example has repeating groups like Course 1, Course 2. To get the first normal form, the table need to be modified to have one Course field as shown below


Second Normal form: A table is in second normal form if and only if it is in 1 NF(no repeating fields) and every non key column is fully dependent on the primary key of the table.

The Student table in this example is in 1NF. But the Teacher Name in the example does not depend on the Student Id primary key, it is dependent on Teacher ID. To get to the second normal form (2NF), we have to put the Teacher details in a separate table.


Third Normal form: A table is in 3NF if and only if it is in 2 NF and every non key column  is non transitively dependent on the primary key of the table , that  means all the non key columns are independent of all other non key columns of the same table in a database.

The Customer table in this example is in 1NF and in 2NF. But there is a transitive dependency between Bank Code and Bank, because Bank Code is not the primary key of this table. To get to the third normal form (3NF), we have to put the bank details in a separate table.



No comments:

Post a Comment