|
A table is in third normal form (3NF) if and only if it is in 2NF and every non key attribute is non transitively dependent on the primary key (i.e. there are no transitive dependencies).
- Anomalies can occur when a relation contains one or more transitive dependencies.
- A relation is in 3NF when it is in 2NF and has no transitive dependencies.
- A relation is in 3NF when 'All non-key attributes are dependent on the key, the whole key and nothing but the key'.
Take the following table structure as an example:
Emp_ID
|
EmpName
|
Emp_DOB
|
Emp_Add
|
Dept_No
|
Dept_Name
|
A101
|
Adam
|
29-10-1979
|
USA
|
11234
|
Accounts
|
B202
|
Brian
|
20-03-1989
|
UK
|
12344
|
IT
|
The table is not in 3NF as the Dept_Name is not directly dependend on the EMP_ID but on the Dept_No and the Emp_Id is associated to the Dept_No because each employee should belomg to some department. So table is split into two following relations to make it in 3NF.
R1(Emp_ID,EmpName,Emp_DOB,Emp_Add,Dept_No)
Emp_ID
|
EmpName
|
Emp_DOB
|
Emp_Add
|
Dept_No
|
A101
|
Adam
|
29-10-1979
|
USA
|
11234
|
B202
|
Brian
|
20-03-1989
|
UK
|
12344
|
R2(Dept_No,Dept_Name)
Dept_No
|
Dept_Name
|
11234
|
Accounts
|
12344
|
IT
|
|