Second Normal Form (2NF)

Further organize and eliminate redundancy in a relational database

By Kevin McAleer,    2 Minutes

Second Normal Form (2NF) is a concept in database normalization that builds upon the principles of First Normal Form (1NF) to further organize and eliminate redundancy in a relational database.

In Second Normal Form, a table must first satisfy the requirements of 1NF. Additionally, it should ensure that all non-key attributes (attributes not part of the primary key) are functionally dependent on the entire primary key, rather than just a portion of it.

To meet the requirements of 2NF:

  1. The table must be in 1NF.
  2. All non-key attributes should be fully dependent on the entire primary key.

To illustrate this, let’s consider a hypothetical table called “Orders” with the following columns: OrderID (primary key), ProductID (primary key), ProductName, and Quantity.

OrderID ProductID ProductName Quantity
1 101 Apple 5
1 102 Banana 3
2 101 Apple 2

In this example, the combination of OrderID and ProductID serves as the composite primary key. However, the attribute “ProductName” is functionally dependent on the ProductID alone, not the entire primary key. This violates the requirements of 2NF.

To normalize this table to 2NF, we would split it into two separate tables:

Table: Orders

OrderID ProductID Quantity
1 101 5
1 102 3
2 101 2

Table: Products

ProductID ProductName
101 Apple
102 Banana

By separating the data into two tables, we ensure that each table contains only the necessary attributes and that non-key attributes are fully dependent on the entire primary key.

The aim of achieving 2NF is to eliminate data redundancy and maintain data integrity by organizing data based on functional dependencies. It helps improve data structure, reduce anomalies during data modifications, and allows for efficient querying and data management.

< Previous Next >