Databases & SQL
Lesson 3 of 4 9 min +60 XP

Joins & Normalization

Combine tables and avoid redundant data.

What you'll learn

  • Explain why data is split across tables
  • Describe an inner join
  • Understand the goal of normalization
Cross-referencing two lists

One list has students and their class IDs, another has class IDs and room numbers — join them to learn which room each student sits in. A JOIN cross-references tables, and normalization keeps each fact in one place so it never contradicts itself.

Relate, don't repeat

Relational databases split data across tables to avoid repetition, then recombine it with joins. An INNER JOIN matches rows from two tables where a shared key is equal — for example, linking an orders table to a customers table by customer_id — returning only rows that match in both.

Normalization

Normalization organizes tables so each fact is stored once. Instead of repeating a customer's address on every order, you store it once in a customers table and reference it by key — reducing redundancy and update anomalies.

SELECT o.id, c.name FROM orders o JOIN customers c ON o.customer_id = c.id; — pairs each order with its customer's name.
Lab · Why not one big table?
  1. Imagine storing each customer's full address on every one of their orders.
  2. Consider what happens when the customer moves.
  3. Explain how splitting into two tables plus a join fixes it.

What you should see: One big table repeats the address and risks inconsistent updates; storing it once in a customers table and joining keeps a single source of truth.

Knowledge Check

+18 XP / correct

1. An INNER JOIN returns rows where…

2. The main goal of normalization is to…