What is 1NF? How do we achieve it.
Database Management System
Computer Science Engineering
584
Advika
First Normal Form (1NF) is the first level of normalization in which a table is required to meet certain criteria to ensure that it contains atomic values, and there is no repeating groups of data.
To meet the criteria of 1NF, a table must have the following properties:
In summary, 1NF requires that a table be organized into rows and columns, with each column containing a single, indivisible value. This ensures that the table contains no repeating groups of data and helps to eliminate data redundancy.
First Normal Form (1NF) requires that each table in a database has a primary key and that each column in that table contains only atomic values (values that cannot be divided any further).
A table is in 1 NF if:
For example, let's consider a table called "Customers" that contains the following columns:
Customer ID | Customer Name | Order IDs |
---|---|---|
1 | John Smith | 1, 2, 3 |
2 | Jane Doe | 4, 5 |
3 | Bob Johnson | 6 |
This table violates 1NF because the "Order IDs" column contains multiple values that are not atomic, i.e., they are composed of multiple order IDs separated by commas. To bring this table into 1NF, we can break down the "Order IDs" column into a separate table called "Orders" and establish a one-to-many relationship between the "Customers" table and the "Orders" table:
Customers Table:
Customer ID | Customer Name |
---|---|
1 | John Smith |
2 | Jane Doe |
3 | Bob Johnson |
Orders Table:
Order ID | Customer ID |
---|---|
1 | 1 |
2 | 1 |
3 | 2 |
4 | 1 |
5 | 2 |
6 | 3 |
By breaking down the "Order IDs" column into a separate table and establishing a one-to-many relationship between the "Customers" and "Orders" tables, we have brought the "Customers" table into 1NF.
Now, each column in the table contains only atomic values, and the table has a primary key (the "Customer ID" column) that uniquely identifies each row.