First Normal Form (1NF)



Database normalization is the process of efficiently organizing data in a database to eliminate the redundant data from the database and ensuring data dependencies make sense. Various Normalization Forms are used to eliminate or reduce data redundancy in database tables.

What is First Normal Form (1NF)?

First Normal Form (1NF) sets the basic rules to organize the data in a database. A database is said to be in first normal form if it satisfies the following conditions −

  • Rule 1 (Atomic Values) − Every column of a table should contain only atomic values. An atomic value is a value that cannot be divided further.

  • Rule 2 (No Repeating Groups) − There are no repeating groups of data. This means a table should not contain repeating columns.

While designing your database tables, you must take care of atleast the First Normal Form compliance otherwise you will put yourself in a big problem during database operatoons.

Rule 1 - Atomic Values

Every column of a table should contain only atomic values. An atomic value is a value that cannot be divided further.

Consider the following CUSTOMERS table which is being used to store customers data −

ID Name Age Salary City Country
1 Ramesh 32 2000.00 Hyderabad, Delhi India
2 Mukesh 40 5000.00 New York USA
3 Sumit 45 4500.00 Muscat Oman
4 Kaushik 25 2500.00 Kolkata India

This table is not in first normal form because the City column can contain multiple values. For example, the first row includes values "Hyderabad" and "Delhi."

Now to bring this table to first normal form, we have to consider the real problem where a customer can stay in different cities which could be in the same or different countries. So we split the table into two separate tables as below −

CUSTOMERS Table

ID Name Age Salary
1 Ramesh 32 2000.00
2 Mukesh 40 5000.00
3 Sumit 45 4500.00
4 Kaushik 25 2500.00

CUSTOMERS_ADDRESS Table

ID City Country
1 Hyderabad India
1 Delhi India
2 New York USA
3 Muscat Oman
4 Kolkata India

Rule 2 - No Repeating Groups

There are no repeating groups of data. This means a table should not contain repeating columns.

Consider the following CUSTOMERS table which is being used to store customers data −

ID Name Age Salary City1 City2 Country
1 Ramesh 32 2000.00 Hyderabad Delhi India
2 Mukesh 40 5000.00 New York USA
3 Sumit 45 4500.00 Muscat Oman
4 Kaushik 25 2500.00 Kolkata India

This table is not in first normal form because we have City column repeated two times and you can see some problems in the current table. This table always reserves space on the disk for two cities, whether the person stays in two cities or not.

To eliminate the repeating columns and bring the table to the first normal form, separate the table into two tables. Put the repeating columns into one of the tables as below −

CUSTOMERS Table

ID Name Age Salary
1 Ramesh 32 2000.00
2 Mukesh 40 5000.00
3 Sumit 45 4500.00
4 Kaushik 25 2500.00

CUSTOMERS_ADDRESS Table

ID City Country
1 Hyderabad India
1 Delhi India
2 New York USA
3 Muscat Oman
4 Kolkata India

Now we have normalized tables which are meeting requirements to be in First Normal Form and now we can assign multiple cities for the same customer without wasting space.

Advertisements