Normalization is the process of reducing redundancy from a set of relations. In database tables, we can use normal forms to carry out this process. The four main normal forms are:
As the figure below shows, these normal forms build upon one another progressively. In this shot, we will focus on the first normal form.
For a table to be in first normal form, it needs to satisfy the following conditions:
Now, let’s look at a concrete example of a table that is currently not in first normal form:
ID | Person | Number |
---|---|---|
1 | Sultan | 4324521, 5254326 |
2 | Aasia | 4924575 |
3 | Farhan | 9875325 |
4 | Vafa | 2468967, 7533678 |
5 | Zakariya | 4675379, 4646388 |
In the above example, the values in the Numbers column are not atomic
. To decompose the table to the first normal form, we must make these values atomic
. We can do this by allocating separate rows to each number, like this:
ID | Person | Number |
---|---|---|
1 | Sultan | 4324521 |
1 | Sultan | 5254326 |
2 | Aasia | 4924575 |
3 | Farhan | 9875325 |
4 | Vafa | 2468967 |
4 | Vafa | 7533678 |
5 | Zakariya | 4675379 |
5 | Zakariya | 4646388 |