Updated May 23, 2023
What is the First Normal Form?
Before understanding the First Normal Form, one must know what Normalization is and why it is done. Normalization, in general terms, is the technique of organizing the data into the database to reduce the insertion, deletion, and updation anomaly and remove data redundancy. This process divides the larger tables into smaller ones and links them with each other through relationships of the primary and foreign keys. Duplicate and unnormalized data consume extra memory and make it challenging to manage the table while insertion, deletion, and updation of tables as the number of data increases. Therefore it is essential to normalize the tables before designing the database of any application.
The first Normal Form, written as 1NF, sets the fundamental rules of data normalization and is the first form used while normalizing the data of tables. It sets certain basic principles of data normalization, which need to be fulfilled by every table. Some of the principles are given below:
- Every column should have single atomic (values which cannot be divided further) values.
- Each column in the table does not have composite values and repeating values, making it difficult to search the values for the column having multiple values. So every column must have a single unique value.
- Values stored in a column should be of the same domain to be in 1NF.
- All the columns present in the table should have unique names.
- A table must have a unique Primary key to identify each record differently.
How Does First Normal Form Work?
According to the main principles of 1NF mentioned above,
- There should not be composite values for a column that can be divided further; if a column in a table has a value that can be divided further, then a separate table should be created for that attribute with different columns in that table with a unique Primary Key. For example, in an Employee table, for the employee_address, which can be divided further, there should be a separate table of Employee_address having Employee_id as its Primary Key and House No, City, and Pincode as different columns.
Table Employee (before 1NF)
|101||Raghu||25||Xyz colony, Agra, 258996|
|102||Rakesh||28||Flat 304, xyz road, Lucknow, 568975|
|103||Rahul||45||House no .123, near a hospital, Varanasi, 245687|
As the Emp_address has so much data for address, for a single Employee, To be in 1NF, the above table can be decomposed into two below-given tables:
Table1: Employee_details (After 1NF)
Table2: Employee_address (After 1NF)
|101||House no. 564, Xyz colony||Agra||258996|
|102||Flat 304, xyz road||Lucknow||568975|
|103||House no .123, near a hospital||Varanasi||245687|
There should be atomic values for a column that is indivisible in 1NF. For example, there can be multiple Emp_projects that they have handled in an Employee table until now. To have a record of all the projects of that employee, there should be a separate record for each project of an employee having unique value instead of projects being separated by ‘, ‘
Table: Emp_projects (Before 1NF)
|103||5||Accounts||Abc, cfg,xyz, hjk|
Table: Emp_projects (After 1NF)
Table: Emp_projects with multiple repeating values in the above example can be broken down into two tables to reduce repetition.
There should not be repeating values present in the table. Repeating values consumes a lot of extra memory and does the search and update slow, and database maintenance difficult. For example, In the above table of Employee_Projects, there are a lot of unnecessary repeating values of Emp_id, Emp_years_of_experience, and Emp_dept, so a new table needs to be created for this to reduce the repetition of values.
Advantages of First Normal Form
Below given are some of the advantages of the First Normal Form (1NF):
- One of the primary advantages of 1NF is that it removes the unnecessary repeating values by creating a separate table and hence does not create any issues while inserting, deleting, and updating the values in the database.
- Working with tables with columns with multiple values separated by ‘,’ is very difficult while searching for a specific value in the database by splitting all the values of a column and converting them in a particular format, wasting time and memory. 1NF makes it easy by creating different rows for different values.
- 1NF forms the basis and is the foremost principle that is followed while creating a database and hence is the most important Normal Form for the tables to proceed further to be normalized with 2NF and 3NF.
- 1NF is important as it creates a Functional dependency between the two tables using the Primary Key and Foreign Key, which plays a crucial role while working with database tables.
- 1NF allows users to use the database queries effectively as it removes ambiguity by removing the null and multiple values of a column which creates major issues in the future while updating and extracting the database.
While working with the databases and creating tables for any application starting, it is essential to normalize all the tables as it helps eliminate insertion, deletion, and update anomalies. Normalization also removes future costs and time. Fewer null values and lesser redundant data make the database more compact. More tables are created through Normalization, which helps in easy and efficient data maintenance. Through Normalization, better search and sorting performance is ensured through indexes and keys, and 1NF plays a vital role in it.
This is a guide to First Normal Form. Here we discuss the introduction, how does first normal form works, and advantages. You may also look at the following articles to learn more –