## Tuesday, January 26, 2010

### Third Normal Form (3NF)

Third Normal Form (3NF) :- A table is said to be in the Third Normal form (3NF) if it satisfy the following conditions:-
1) It should be in the 2NF
2) It should not contain any transitive dependency which means that any non key column of the table should not be dependent on another non key column.

For example, let consider a table EmpProjDetails which contains the details about the employee and its project.

Table Name:-  EmpProjDetails
Primary Key: -  EmpId

EmpId      EmpName       EmpRegDate       Projectid        ProjectName
1                  Vivek               01/01/2006            1               Bankingexpress
2                  Neha                06/06/2007            2               BankingReport

Now, the table EmpProjDetails is in Second Normal Form (2NF), but it is not in the Third Normal Form because the non key column projectName is dependent on another non key column ProjectId. So to convert this table in the Third Normal Form, we need to decompose this table into the two tables EmpInfo and ProjInfo whose structure is given below:-

Table Name:- EmpInfo
Primary Key: - EmpId

EmpId       EmpName          EmpRegDate         Projectid
1                  Vivek                   01/01/2006               1
2                  Neha                    06/06/2007               2

Table Name:- ProjInfo
Primary Key: - ProjectId

ProjectId          ProjectName
1                   Bankingexpress
2                   BankingReport

Now the above tables are in the Third Normal Form since they satisfy all the conditions for the Third Normal Form.