DBMS- First Normal Form

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:

  1. The table must have a primary key so as to eliminate duplicity in the rows in the table.
  2. 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.
  3. Data Values in a column must be of the same kind.
  4. All nonkey 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).

S_Id S_Name Record
Subject Marks
106 Anna English 76
    Science 65
    Maths 84
108 Alan English 88
    Science 78
    Maths 56

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.

Method 1:

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.

S_Id S_Name Subject Marks
106 Anna English 76
106 Anna Science 65
106 Anna Maths 84
108 Alan English 88
108 Alan Science 78
108 Alan Maths 56

Now, the table is in its First Normal Form i.e., 1NF.

Method 2:

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

S_Id S_Name
106 Anna
108 Alan

Second Table Name: Stu_Record

S_Id Subject Marks
106 English 76
106 Science 65
106 Maths 84
108 English 88
108 Science 78
108 Maths 56

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.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *