A relation is in 1NF if every tuple has exactly one value for each attribute. In other words, we can say that every column should have a unique or atomic value related to the corresponding attribute.
A database is in first normal form if every relation includes in a database is in 1NF.
First normal form deals only with the basic structure of the relationship and does not resolve the problems of redundant information and any other anomalies.
Let’s understand this with the help of an example of an organization where we have information about employee_id, employee_name, phone number, and their salary.
Table 1. Non-Domain Form
Here we can see that an employee can have more than one phone number so, each tuple of the above table does not have only one value for each attribute.
For converting it into a 1NF we use the following steps-
- For each repeating field, value creates a new tuple.
- Insert the repeating field value in that field of the new tuple
- duplicate the values of all other attributes of the original tuple and put them in a new tuple.
In our example, we have a phone_no field of Ashish and Piyush have repeating value. So we have to create new tuples only for these two employees. See the changes in the below table.
Table 1.1 Normalized Form
Problems and anomalies in 1NF(first normal form):
We can not insert the information of an employee who does not have a phone no.
If we delete a whole first tuple of a particular employee then we delete not only the phone no of an employee but also lose other information such as salary and employee_id.
For example: if we delete a tuple of employee Priya whose phone is disconnected then we also lose other information of Priya such as salary.
In this form of the relation 1NF, we have the same information repeated many times. If we want to update some information, for this first we have to search for all the tuples containing that information and then update all the tuples.
for example: if the salary of Piyush gets incremented to 25000 and we want to this information in our relation, for this first of all we have to search all the tuples having employee name ‘Piyush’ and then update the salary to 25000 of each tuple. But if we forget updation of any of tuple named Piyush then it will result in inconsistency. to avoid this we go for 2NF.
Even after converting our data table into 1NF where we have unique or single tuple value for a particular attribute we have redundancy and anomalies problem with us. So for removing problems of 1NF we have to go for 2NF. So in our next blog post we will update you with the same.
Hope! you would have liked this blog. Please feel free to let us know if you have any doubts about this post. You can also write to us at firstname.lastname@example.org. Have a good time!