CSE Roadmap

Core tier · about 4 hours · 5 parts

Part 3 of 5 · 1 min read

Second normal form (2NF)

No partial dependency on a composite key.

Think of a two-part key where part of the information only ever needed the first part, not both parts together.

In plain words: 2NF requires 1NF, plus no partial dependency: every non-key column must depend on the entire key, not just part of it. This only matters for tables with a composite key.

A worked example. order_items (order_id, book_id, quantity, book_title) violates 2NF, since book_title depends only on book_id, not on the full (order_id, book_id) key. Removing book_title and getting it from books instead satisfies 2NF.

The key lines.

-- violates 2NF: book_title is a partial dependency
order_items (order_id, book_id, quantity, book_title)

-- satisfies 2NF: book_title comes from books via book_id
order_items (order_id, book_id, quantity)
books (book_id, title)

Second normal form (2NF)

Second normal form requires 1NF and no partial dependency: every non-key column must depend on the whole composite key, not a subset of it.

Example: book_title depending only on book_id, not the full (order_id, book_id) key, violates 2NF.