A relation is said to be in Third Normal Form (3NF) if:
3NF helps reduce data redundancy and improves data integrity by removing attributes that depend on other non-key attributes.
A transitive dependency occurs when a non-key attribute depends on another non-key attribute instead of depending directly on the primary key.
For example:
A → B and B → C
Then C is transitively dependent on A through B.
To achieve 3NF, all transitive dependencies must be removed.
A relation is in 3NF if, for every non-trivial functional dependency X → Y, at least one of the following conditions is true:
Consider the following EMPLOYEE_DETAIL table:
| EMP_ID | EMP_NAME | EMP_ZIP | EMP_STATE | EMP_CITY |
|---|---|---|---|---|
| 222 | Harry | 201010 | UP | Noida |
| 333 | Stephan | 02228 | US | Boston |
| 444 | Lan | 60007 | US | Chicago |
| 555 | Katharine | 06389 | UK | Norwich |
| 666 | John | 462007 | MP | Bhopal |
Key Information
Candidate Key: {EMP_ID}
Non-Prime Attributes:
In the above table:
This means:
Therefore:
This violates the rule of Third Normal Form.
To remove the transitive dependency, move EMP_STATE and EMP_CITY into a separate table.
EMPLOYEE Table
| EMP_ID | EMP_NAME | EMP_ZIP |
|---|---|---|
| 222 | Harry | 201010 |
| 333 | Stephan | 02228 |
| 444 | Lan | 60007 |
| 555 | Katharine | 06389 |
| 666 | John | 462007 |
EMPLOYEE_ZIP Table
| EMP_ZIP | EMP_STATE | EMP_CITY |
|---|---|---|
| 201010 | UP | Noida |
| 02228 | US | Boston |
| 60007 | US | Chicago |
| 06389 | UK | Norwich |
| 462007 | MP | Bhopal |
After decomposition:
Therefore, both tables satisfy the requirements of Third Normal Form (3NF).
Even if the relation in 3NF, it still suffers from insertion, deletion and updation anomalies. So before discussing the next higher normal form, we will explain these anomalies.
To discuss the various anomalies, we will consider the STAFF relation that holds information about the staff, the equipment key they have been allocated and the language in which they are fluent.
STAFF (@S_Name + @Equipment + @Language) where @symbol tells that it is a primary key.
STAFF Relation:
| S_Name | Equipment | Language | ||
|---|---|---|---|---|
| Anurag | PC | English | Mainframe | French |
| Kapil | PC | English | French | Japanese |
In the above visualization it shows that it is not a relation. In order to represent it as a relation in 1NF, we need to convert it to the form as shown in the following table.
STAFF Relation:
| S_Name | Equipment | Language |
|---|---|---|
| Anurag | PC | English |
| Anurag | PC | French |
| Anurag | Mainframe | English |
| Anurag | Mainframe | French |
| Kapil | PC | English |
| Kapil | PC | French |
| Kapil | PC | Japanese |
In the above relation, every STAFF has two independent sets of features associated with it.
The STAFF relation has a primary key composed of S_Name, Equipment and Language. There is no transitive dependency, so the relation STAFF is in 3NF. But it stills suffers from the insertion, deletion and updation anomalies which are explained as follows.
Suppose an Anurag learns a new language Japanese then we will have to insert two new records into the STAFF relation. Similarly, if the Equipment values corresponding to staff Anurag changes in numbers from 2 to 5, then with introduction of new language Japanese we will have to insert multiple records into the STAFF relation which results in redundancy.
Let us suppose that the name of the staff changed from Anurag to Anuraj here sue to some reasons then multiple records need to be updated which may result in inconsistency of data.
Let us suppose that an staff Kapil has his equipment PC deallocated, then all the information about his languages skills would be lost due to deletion of these records which may result in loss of vital information.
All these anomalies are encountered due to the presence of multivalued dependency which is removed in fourth normal form. The concept of multivalued dependency and 4NF will be explained later.
We request you to subscribe our newsletter for upcoming updates.