Fifth normal form (5NF), also known as Project-join normal form (PJ/NF) is a level of database normalization designed to reduce redundancy in relational databases recording multi-valued facts by isolating semantically related multiple relationships. A table is said to be in the 5NF if and only if every join dependency in it is implied by the candidate keys.
A join dependency *{A, B, … Z} on R is implied by the candidate key(s) of R if and only if each of A, B, …, Z is a superkey for R.[1]
Contents |
Consider the following example:
Travelling Salesman | Brand | Product Type |
---|---|---|
Jack Schneider | Acme | Vacuum Cleaner |
Jack Schneider | Acme | Breadbox |
Willy Loman | Robusto | Pruning Shears |
Willy Loman | Robusto | Vacuum Cleaner |
Willy Loman | Robusto | Breadbox |
Willy Loman | Robusto | Umbrella Stand |
Louis Ferguson | Robusto | Vacuum Cleaner |
Louis Ferguson | Robusto | Telescope |
Louis Ferguson | Acme | Vacuum Cleaner |
Louis Ferguson | Acme | Lava Lamp |
Louis Ferguson | Nimbus | Tie Rack |
The table's predicate is: Products of the type designated by Product Type, made by the brand designated by Brand, are available from the travelling salesman designated by Travelling Salesman.
In the absence of any rules restricting the valid possible combinations of Travelling Salesman, Brand, and Product Type, the three-attribute table above is necessary in order to model the situation correctly.
Suppose, however, that the following rule applies: A Travelling Salesman has certain Brands and certain Product Types in his repertoire. If Brand B is in his repertoire, and Product Type P is in his repertoire, then (assuming Brand B makes Product Type P), the Travelling Salesman must offer products of Product Type P made by Brand B.
In that case, it is possible to split the table into three:
Travelling Salesman | Product Type |
---|---|
Jack Schneider | Vacuum Cleaner |
Jack Schneider | Breadbox |
Willy Loman | Pruning Shears |
Willy Loman | Vacuum Cleaner |
Willy Loman | Breadbox |
Willy Loman | Umbrella Stand |
Louis Ferguson | Telescope |
Louis Ferguson | Vacuum Cleaner |
Louis Ferguson | Lava Lamp |
Louis Ferguson | Tie Rack |
Travelling Salesman | Brand |
---|---|
Jack Schneider | Acme |
Willy Loman | Robusto |
Louis Ferguson | Robusto |
Louis Ferguson | Acme |
Louis Ferguson | Nimbus |
Brand | Product Type |
---|---|
Acme | Vacuum Cleaner |
Acme | Breadbox |
Acme | Lava Lamp |
Robusto | Pruning Shears |
Robusto | Vacuum Cleaner |
Robusto | Breadbox |
Robusto | Umbrella Stand |
Robusto | Telescope |
Nimbus | Tie Rack |
Note how this setup helps to remove redundancy. Suppose that Jack Schneider starts selling Robusto's products. In the previous setup we would have to add two new entries since Jack Schneider is able to sell two Product Types covered by Robusto: Breadboxes and Vacuum Cleaners. With the new setup we need only add a single entry (in Brands By Travelling Salesman).
Only in rare situations does a 4NF table not conform to 5NF. These are situations in which a complex real-world constraint governing the valid combinations of attribute values in the 4NF table is not implicit in the structure of that table. If such a table is not normalized to 5NF, the burden of maintaining the logical consistency of the data within the table must be carried partly by the application responsible for insertions, deletions, and updates to it; and there is a heightened risk that the data within the table will become inconsistent. In contrast, the 5NF design excludes the possibility of such inconsistencies.
|