Skip to content
SQL

Database Normalization Explained: 1NF to 5NF with Simple Examples

Learn database normalization step by step, from 1NF to 5NF. One small bookstore database, simple explanations and before-and-after tables for every rule.

A messy orders table with two books and two prices in one cell, split into clean books and publishers tables in VisuaLeaf.
From one messy table to clean, normalized tables, step by step.

Introduction

Imagine your class keeps a list of who borrowed which books from the school library. At first, someone writes everything in one big notebook. It works for a week. Then a student's name is spelled two different ways, a book shows up with two different prices, and nobody can find anything.

Normalization is the fix for that mess. It's a set of simple rules for organizing data in a database so that:

  • every piece of information is written down only once,
  • it's written in the right place,
  • and it can't quietly turn into a lie later.

The rules have names that sound scary: 1NF, 2NF, 3NF, BCNF, 4NF and 5NF. ("NF" just means "Normal Form".) But each one is only asking a simple question about your table. Let's go through them one by one.


Prefer watching instead of reading? Here's the same lesson as a video, with the same Booknook tables and pictures:

Database Normalization Explained Simply | 1NF, 2NF, 3NF, 4NF and 5NF

If you like reading at your own pace, keep scrolling. Everything in the video is explained below, step by step.


The database we'll use

To make this easy to follow, I created a small practice database just for this article. It's called Booknook, and it's a pretend online bookstore.

Booknook has:

  • two customers: Maya Chen and Leo Park,
  • three books: The Silent Sea (costs 12), Paper Moons (costs 9) and Iron Garden (costs 15),
  • two publishers: Northwind Press (from the USA) and Bluefield Books (from the UK).

All the names are made up. We'll use the same data from the first picture to the last, so you can see exactly how the tables change at each step.

Before we start, here's what each rule does, in one line:

Rule What it does
1NF One value per cell
2NF Every column depends on the whole key
3NF No column depends on another normal column
BCNF Anything that decides another value must be a key
4NF Don't mix separate lists in one table
5NF Save pairs of facts as pairs

Don't worry if these don't make sense yet. We'll go through them one by one with pictures.

A quick word you'll see a lot: a key is the column (or columns) that identifies a row, like a student ID number. No two rows can have the same key.

Here's how a beginner might first store Booknook's orders: everything in one table.

A VisuaLeaf data grid with one orders table where order 5001 stores two books, two prices, two publishers and two countries in single cells, highlighted in red.
One big, messy table: order 5001 squeezes two books, two prices, and two publishers into single cells.

Look at order 5001. Maya bought two books, so the person who made this table just typed both into one box: "The Silent Sea, Paper Moons". Same for the prices: "12, 9". And Maya's name appears twice, once for each order.

It looks fine. But when you actually use it, it falls apart.

Step 1. First Normal Form (1NF)

The rule: every box in the table holds just one value.

Here's the problem up close:

A close-up of two order rows where the books cell contains "The Silent Sea, Paper Moons" and the prices cell contains "12, 9", both highlighted in red.
Two values in one cell. Which price belongs to which book? You only know by counting commas.

Think of it like writing two phone numbers in the same contact field. Your phone doesn't know which one to call.

The database has the same problem. To the computer, "12, 9" isn't two prices. It's just a bit of text with a comma in it. So you can't:

  • add up how much order 5001 cost,
  • count how many times The Silent Sea was sold,
  • or sort books by price.

The fix: give each book its own row.

A data grid with columns order_id, book, customer and price where order 5001 now has two separate rows, one for The Silent Sea and one for Paper Moons, outlined in green.
One row per book. Every cell now holds exactly one value.

Now order 5001 has two rows, one for each book. Every price is a real number the computer can add and sort.

One small change: the order number alone isn't enough to point to one row anymore, because 5001 appears twice. So the key is now order number + book title together. That combination is always unique.

Here's the full table after step 1, with the publisher and country added back in:

The full 1NF table with order_id and book as a composite primary key, plus customer, price, publisher and country columns, all rows outlined in green.
Now in 1NF: one value per cell, and a key made of order_id + book.

Much better! But notice how many things repeat: "Maya Chen", "12", "Bluefield Books", "UK"... That's what the next steps clean up.

Step 2. Second Normal Form (2NF)

The rule: each column has to depend on the whole key, not just one part of it.

Our key has two parts: the order number and the book. So let's ask every other column a question: "To know your value, do you need both parts, or just one?"

The 1NF table with Maya Chen highlighted in gold for order 5001 and the price 12 highlighted in red for both rows of The Silent Sea, with notes saying customer depends only on order_id and price depends only on b;ook.
Depends on only part of the key: customer only needs order_id, price only needs book.
  • customer only needs the order number. Order 5001 is Maya's, whatever book you look at.
  • price only needs the book. The Silent Sea costs 12 in every order.

Why is that a problem? Imagine The Silent Sea goes up to 14. You change it in one row and forget the other. Now your database says the same book costs 12 and 14. Which one is true? Nobody knows anymore.

The fix: split the table so each fact sits next to the thing it actually belongs to.

Three linked tables: orders with order_id and customer, order_items with order_id and book, and books with book, price, publisher and country, connected with one-to-many lines.
Split by what each fact depends on: orders, order_items and books.

Now we have three smaller tables:

  • orders says who placed each order.
  • books says the price and publisher of each book.
  • order_items just connects them: which books are in which order.

The price of every book is now written once. Change it in one place, and it's right everywhere.

Step 3. Third Normal Form (3NF)

The rule: a column shouldn't depend on another normal column. It should only depend on the key.

Look at the books table:

The books table with Bluefield Books highlighted in gold twice and UK highlighted in red twice, with a note saying country depends on publisher, not book.
A fact about a fact: country describes the publisher, not the book.

Does the book Paper Moons have a country? Not really. Its publisher, Bluefield Books, is from the UK. The country is information about the publisher, not about the book.

It's like your class list storing each student's teacher and the teacher's phone number on every line. The phone number belongs to the teacher, not the student. If the teacher changes phones, you'd have to fix 30 lines.

The fix: give publishers their own table.

> **Alt:** Two linked tables: books with book, price and publisher, and publishers with publisher and country, connected with a one-to-many line.
Small, clean tables: each publisher's country is stored exactly once.

Now Booknook has four tidy tables: orders, order items, books and publishers.

Here's how the four tables connect, straight from VisuaLeaf's diagram view:

A VisuaLeaf diagram of the four Booknook tables, orders, order_items, books and publishers, with lines showing one-to-many relationships between them.
The finished store design: each table holds one kind of fact, and the lines show how they connect.

Good news: most real databases stop right here. 3NF is enough for almost everything.

The last three rules only matter when your data has special situations. Our first Booknook tables don't have any of those, so to show them, I added three small extra tables to Booknook.

Step 4. Boyce–Codd Normal Form (BCNF)

Booknook starts a book club. There's one rule: each host leads only one genre. Ana leads Mystery. Tom and Rita both lead Sci-Fi.

A club_signups table with member and genre as the key and a host column, where Ana and Mystery are highlighted in gold on two rows, with a note saying host determines genre but host isn't a key.
A non-key column decides a key column: knowing the host tells you the genre.

The key here is member + genre. But there's a hidden rule: if you know the host, you automatically know the genre. Ana always means Mystery.

So "Ana leads Mystery" gets written again for every member Ana hosts. And nothing stops someone from typing "Ana — Sci-Fi" by mistake.

The rule of BCNF: if a column decides another column, it has to be a key. Here, the host decides the genre, so hosts get their own table.

Two linked tables: memberships with member and host, and hosts with host and genre, connected with a one-to-many line.
Every determinant is a key: the host-to-genre rule is stored once.

Now "Ana leads Mystery" is written exactly once.

Step 5. Fourth Normal Form (4NF)

Booknook wants to save two more things about each book: its authors and its formats (hardcover, eBook, paperback). The Silent Sea has two authors and comes in two formats.

If you put both lists in one table, this happens:

 A book_details table where The Silent Sea appears in four red-outlined rows, combining each of its two authors with each of its two formats.
Two independent lists, multiplied: every author gets paired with every format.

Authors and formats have nothing to do with each other. But because they share a table, every author has to be paired with every format. 2 authors × 2 formats = 4 rows.

It's like a school storing your sports and your languages in one list. Football + English, football + French, basketball + English, basketball + French... You'd get a row for every combination, even though they're not connected at all.

And if Booknook adds a paperback version, it needs two new rows, one for each author. Forget one, and the data is wrong.

The fix: one list per table.

Two separate tables: book_authors with book and author, and book_formats with book and format.
One independent fact per table: add a format once, not once per author.

Two short, simple lists. Add a new format once, and you're done.

Step 6. Fifth Normal Form (5NF)

This is the rarest rule, so don't worry if you need to read it twice.

Booknook works with distributors, companies that deliver books to different countries. There's one business rule:

If a distributor works with a publisher, operates in a country, and the publisher sells in that country, then the distributor sells that publisher's books there.

A distribution table with distributor, publisher and country, where the pair Atlas Distribution and Northwind Press is highlighted in gold on two rows.
Three facts hiding in one row: each sale is built from three separate pairs.

Each row looks like one fact, but it's actually built from three smaller facts:

  1. which distributor works with which publisher,
  2. which distributor works in which country,
  3. which publisher sells in which country.

You might think: "Let's just split it into two tables." Let's try that, then put them back together:

The result of joining only two of the tables, showing the four real rows plus an extra row, Atlas Distribution, Bluefield Books, USA, highlighted in red.
Split in two → fake rows. Putting them back together invents a sale that never happened.

A fifth row appears out of nowhere: Atlas selling Bluefield Books in the USA. That never happened. Bluefield doesn't even sell in the USA! Two tables weren't enough to hold the truth.

The fix: split it into all three small facts.

Three tables side by side: distributor_publishers, distributor_countries and publisher_countries, with a note saying joining all three gives exactly the four original rows.
Split in three → nothing lost. Putting all three together gives back exactly the 4 original rows.

Put all three tables back together, and you get exactly the original four rows. Nothing missing, nothing made up. That's 5NF.

All six rules on one page

Rule The question it asks What we did in Booknook
1NF Does every box hold just one value? Gave each book its own row
2NF Does every column need the whole key? Split into orders, order items and books
3NF Is a column describing another column? Moved country into a publishers table
BCNF Does a non-key column decide something? Gave hosts their own table
4NF Are two unrelated lists mixed together? Split authors and formats apart
5NF Is one row secretly several facts? Split distribution into three tables

Do you need all six?

Most of the time, no. If you get to 3NF, you've already fixed almost every problem that causes real mistakes. The last three are for special cases, but now you'll recognize them when you see them.

The big idea to remember is the one we started with: write every fact once, in the place where it belongs.


Practice it yourself

The Booknook database is real. I built it in PostgreSQL and opened it in VisuaLeaf. It has two schemas (a schema is like a folder of tables): unnormalized holds every broken table from this article, and normalized holds the fixed ones. You can even run a query and watch the fake 5NF row appear yourself.

To look at any table, open the schema in VisuaLeaf and run a simple query, for example:

SELECT * FROM normalized.books;
The VisuaLeaf app connected to the booknook PostgreSQL database, with the unnormalized and normalized schemas in the sidebar and the query SELECT * FROM normalized.books showing three books with their price and publisher.
The Booknook database in VisuaLeaf: the broken tables in one schema, the fixed ones in the other.

The best way to really understand normalization is to break a table, then fix it with your own hands.