Database Normalization is a technique of organizing the data in the database. Database Normalization is a systematic approach of decomposing tables to eliminate data redundancy(repetition) and undesirable characteristics. For example, Insertion, Update and Deletion anomalies. It is a multi-step process that puts data into tabular form, removing duplicated data from the relation tables.
Normalization is used for mainly two purposes.
- Eliminating redundant(useless) data.
- Ensuring data dependencies make sense i.e. data is logically stored.
First Normal Form (1NF)
For a table to be in the First Normal Form, it should follow the following 4 rules:
- It should only have single(atomic) valued attributes/columns.
- Values stored in a column should be of the same domain
- All the columns in a table should have unique names.
- And the order in which data is stored does not matter.
Second Normal Form (2NF)
For a table to be in the Second Normal Form,
- It should be in the First Normal form.
- And, it should not have Partial Dependency.
Third Normal Form (3NF)
A table is said to be in the Third Normal Form when,
- It is in the Second Normal form.
- And, it doesn’t have Transitive Dependency.
Here is an example of a denormalized table
Film Agents Info
|A1||A&I Gold||New Cine||Los Angels||111222333||BreadPtch||Brian|
Let’s Take This table to 1NF (First Normal Form).
We shall Split the above table into two tables.
|Office Location||Office Contact|
Let’s Take the above tables to 2NF (Second Normal Form) We Shall split the above two tables into four tables.
Let’s Take the above tables to 3NF (Third Normal Form).
We Shall split the above two tables into five tables.
1,574 total views, 4 views today