Normalizing a table to 3NF will remove most of the anomalies from your tables, but there are a few that can slip through the cracks.
It is possible to create tables where a field can determine more than one value in another field. For example, if a CD contained stories written by more than one author and read by more than one reader, a CDNo value could determine more than one Author value and more than one Reader value. Records from such a table are shown in the following illustration.
Fourth Normal Form (4NF) is a crucial concept in database normalization, a process aimed at organizing data in a structured and efficient manner. It is an extension of the Third Normal Form (3NF) and focuses on eliminating certain types of redundancies not addressed by 3NF. To understand how 4NF distinguishes itself from 3NF, we must first briefly revisit the concepts of functional dependencies and 3NF. Third Normal Form (3NF) is based on the idea of eliminating transitive dependencies, which occur when a non-prime attribute is functionally dependent on another non-prime attribute through a prime attribute. A relation is in 3NF if it satisfies the following conditions:
- The relation is in Second Normal Form (2NF).
- Every non-prime attribute is non-transitively dependent on every candidate key.
However, 3NF is not sufficient to address all redundancy issues in a database, particularly when dealing with multi-valued dependencies (MVDs).
This is where Fourth Normal Form (4NF) comes into play. Fourth Normal Form (4NF) deals with the elimination of multi-valued dependencies. A multi-valued dependency exists in a relation when two or more independent sets of attributes depend on a third set of attributes, leading to redundancy.
A relation is in 4NF if it satisfies the following conditions:
- The relation is in Third Normal Form (3NF).
- There are no non-trivial multi-valued dependencies in the relation.
To better illustrate the difference between 3NF and 4NF, consider a relation R(A, B, C) with the following dependencies:
- A → B (A functionally determines B)
- A →→ C (A multi-valued dependency on C)
The relation is in 3NF because there are no transitive dependencies. However, it is not in 4NF due to the presence of a non-trivial multi-valued dependency. To achieve 4NF, the relation should be decomposed into two separate relations: R1(A, B) and R2(A, C).
In summary, Fourth Normal Form (4NF) distinguishes itself from Third Normal Form (3NF) by addressing multi-valued dependencies, which are not dealt with in 3NF. While 3NF is concerned with eliminating transitive dependencies, 4NF seeks to remove redundancies caused by independent sets of attributes that depend on a third set of attributes. By achieving 4NF, a database can further minimize redundancy and improve data integrity.
When designing a database, your goal is to normalize its tables to 3NF. Except in special circumstances, like those described above, 3NF will be sufficient to ensure you don't lose any important data and that your database will update, delete, and modify data efficiently. There are normal forms above 4NF (called Fifth Normal Form and domain/key normal form), but they are highly theoretical and not reasonable design goals when normalizing the tables of a database. The next lesson discusses denormalization.