Second Normal Form (2NF)

Rules of 2NF

  • The table is in 1NF.
  • No partial dependency: every non-key column depends on the whole primary key, not just part of it.

Note: 2NF only matters for tables with a composite primary key. A table in 1NF with a single-column key is automatically in 2NF.

Example

Not in 2NF. Key = (OrderID, ProductID), but ProductName depends only on ProductID:

OrderIDProductIDProductNameQuantity
1011Basmati Rice 5kg10
1051Basmati Rice 5kg6

In 2NF: move product facts to their own table.

OrderIDProductIDQuantity
101110
10516
ProductIDProductName
1Basmati Rice 5kg

This is exactly how the demo database separates OrderDetails from Products.