A relation is said to be in a particular normal form when it follows certain set of rules. So is the case with 1NF. A data table is said to be in First Normal Form if and only if it follows the following set of constraints:
- The table must have a primary key so as to eliminate duplicity in the rows in the table.
- The cells must contain single valued data (or one value per cell) i.e., there should be no repeating groups or arrays in the table.
- Data Values in a column must be of the same kind.
- All non–key attributes of the relation must fully depend on the primary key.
Let us look into the details of First Normal Form with the help of an example.
Let us consider a table STU which records information about students like their name (S_Name), marks in various subjects (English, Hindi, and Maths) and their student ids (S_Id).
Table Name: STU
Now, if you observe the above table closely, then we can see that the table is currently an unnormalized table.
How to achieve First Normal Form in a Table?
In order to normalize any unnormalized relation, there are two ways to achieve the 1st Normal Form. Let us have a closer look at these methods now.
In order to normalize the above relation, we will have to follow the following steps:
- Convert the composite attribute (Record in this example) into single independent attributes.
- Duplicate the values in the attributes so that repeating groups are eliminated.
Once these two steps are followed, the above unnormalized table is converted into the following table.
Now, the table is in its First Normal Form i.e., 1NF.
Yet another efficient
way to normalize the table and minimize the amount of redundancy in the
relation is that we may split the original relation into two (or more)
distinct relations. These relations are then linked to each other with the help
of foreign key attributes.
First Table Name: Stu_Info
Second Table Name: Stu_Record
Hence, the original table is divided into two tables namely, Stu_Info and Stu_Record and these are then linked together with the help of foreign key (S_Id). So now these tables are in their 1st normal form.
Which approach to follow for First Normal Form?
To sum up, you may follow either method to convert any un-normalized relation into its first normal form. However, the second method is more appropriate as it helps minimize redundancy of data in tables. This adds to the efficiency of the relations and saves memory space too.