Lesson 4 of 14
8. SQL vs NoSQL

8.3 What is normalisation, and what are joins?

3 min read+10 XP

In the office: The ledger never writes an author's address on every book line. It writes it once, in the authors ledger, and every book line says "see line 1". If the author moves, you fix one line. To print a full order slip, the clerk flips between ledgers to gather the details.

In the system:

  • Normalisation means organising tables so each fact is stored once. In plain words: no repeated groups inside a row, every column describes its row's key, and no column depends on another non-key column. (Database courses call these the first, second and third normal forms.)
  • A join combines rows from tables at read time, matching keys: orders + order_items + books + authors to print an order slip.

Why normalise:

  • No contradictions: the author's name exists in one place, so it can't disagree with itself.
  • Cheap updates: rename an author with one UPDATE on one row.
  • Flexible questions: "best-selling authors this month" or "users who bought two books by the same author" are just new queries; you didn't have to plan for them.

The cost: reads that need data from many tables do join work every time, and joins get hard when tables live on different machines (Chapter 15).

Memory code: "Write it once, link it everywhere, join when you read."