How to Implement Second Normal Form
In this article I am going to explain how to Implement second normal form.
Introduction
Normalization is used to organize the content of table. Normalization is a technique which eliminate redundancy and inconsistent dependency of data from database. Normalization makes database more flexible.
Basic Goal of normalization
- Arrange data in database in to logical grouping.
- Eliminate redundancy of data, it means minimizing the duplicate data in database.
- Eliminate inconsistency of data
Second Normal Form
For a table in second normal from it must be in first normal form and every attribute is fully functionally dependent on entire primary key. Second normal form is used to remove redundant row data.
Example
In this table data is in first normal form but not in second normal form. Here emp_id and project_number is combined primary key but you can find employee name by emp_id, project name by project number. So we divide this table in more than one table.
Table in First Normal Form but not in Second Normal Form
emp_id |
Project_Number |
hour |
emp_name |
Project_Name |
Project_Location |
D001 |
P0086 |
40 |
Vipendra |
Metro Ticketing System |
Delhi |
D002 |
P0096 |
55 |
Deepak |
Railway Ticketing System |
Lucknow |
Now we divide this table in three different tables and these tables are in second normal form.
Table 1
emp_id |
Project_Number |
hour |
D001 |
P0086 |
40 |
D002 |
P0096 |
55 |
Table 2
emp_id |
emp_name |
D001 |
Vipendra |
D002 |
Deepak |
Table 3
Project_Number |
Project_Name |
Project_Location |
P0086 |
Metro Ticketing System |
Delhi |
P0096 |
Railway Ticketing System |
Lucknow |