Learn SQL Lesson

1NF, 2NF, and 3NF

Most application databases aim for first, second, and third normal form. These are practical rules for organizing data well.

First normal form (1NF) means each column contains a single atomic value, and each row can be identified uniquely. For example, a column like `products = 'Keyboard, Mouse'` breaks 1NF because it stores multiple values in one field.

Second normal form (2NF) builds on 1NF. It means every non-key column must depend on the whole key, not only part of it. This matters most when a table uses a composite key. If an `order_items` table is keyed by `(order_id, product_id)`, then `quantity` depends on the whole key, but `customer_name` depends only on `order_id` and belongs somewhere else.

Third normal form (3NF) builds on 2NF. It means non-key columns should depend only on the key, not on other non-key columns. For example, if a `customers` table stores `zip_code` and `city`, and `city` is always determined by `zip_code`, then `city` depends indirectly on the customer key. That is a sign the design may need another table.

In practice, 3NF gives you a strong default structure:

customers(id, name, email)
products(id, name, price)
orders(id, customer_id, order_date)
order_items(order_id, product_id, quantity)

Each fact lives where it logically belongs, and the keys describe how the tables connect.

Open interactive editor