Converting to Second Normal Form (2NF) in Databases

In the previous section we discussed how to convert to the first normal form. Now let’s look at converting to 2NF.

Converting to the 2NF involves removing the partial dependencies by:

  • Identifying the determinants for each partial dependency and assigning the corresponding attributes.
  • Writing out the entire composite primary key identified in 1NF.

All the above separately then become a new table, with the determinants as the primary keys, as well as our original composite primary key. Since they become new tables, we need to choose appropriate names for them.

Using our usual table:

  • Customer_id becomes a determinant, and therefore a primary key of the CUSTOMER table since it contains details about customers.
  • Teller_id becomes a determinant, and therefore a primary key of the TELLER table since it contains details about tellers.
  • Customer_id and Teller_id become a composite primary key of a SALE table since a sale only exists when a customer makes a purchase, and when a teller rings up the products.

To demonstrate 2NF using the dependency diagram, there would now be three tables with no partial dependencies, but transitive dependencies still exist:

Congratulations! You have just learnt how to convert to 2NF.

Click here to learn how to convert to 3NF.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store