← All courses
Intermediate4 lessons + 3 bonus

Joins

Query multiple tables at once. Master INNER, LEFT, RIGHT, and FULL OUTER joins — and finally understand which rows appear in your result and why.

Start course free →

Joins made simple

  • Think in row grain first: one row should represent one business entity.
  • Start with INNER JOIN to validate key matches before widening with LEFT JOIN.
  • If row counts explode, check key uniqueness and pre-aggregate first.

Professional learning blueprint

Master table relationships and build accurate multi-table queries.

Outcomes

  • Choose the right join type for each business question.
  • Prevent row multiplication and duplicate-driven errors.
  • Validate join quality with row-count and key checks.

Real-world use

  • People + org analytics (employees, departments, managers).
  • Cross-system reconciliations between operational tables.
  • Analyst handoffs for BI dashboards and data marts.

Fast study plan

  1. 1. Start with INNER JOIN to prove key matches first.
  2. 2. Use LEFT JOIN only when preserving base-table rows is required.
  3. 3. Audit count(*) and count(distinct key) after each join step.

Deep learning journey

Join Accuracy Arc

Master relationship logic and prevent row-multiplication bugs in multi-table analysis.

Join key validation

Select correct keys and verify cardinality before combining tables.

  • PK/FK matching
  • One-to-many reasoning
  • Join test counts

Join type strategy

Use INNER/LEFT/RIGHT/FULL intentionally.

  • Preserve base rows
  • Optional dimensions
  • Missing-match interpretation

Multi-table composition

Scale safely from 2 to 4-table queries.

  • Incremental joins
  • Pre-aggregation
  • Duplicate prevention

Bonus lesson units

Additional lessons to master this track (3)

1. Self-joins for hierarchy

Use a table alias to join a table to itself — ideal for org-chart manager/employee relationships.

2. LATERAL joins

Use LATERAL to run a correlated sub-select per row — replaces loops and cursors for per-row lookups.

3. Join performance and EXPLAIN ANALYZE

Read EXPLAIN output to identify slow join strategies and add covering indexes.

Expanded practice

Mission exercises (10)

Open playground →

1. Employee-department map

easy

Join employees to departments with clear aliases and deterministic sorting.

2. Department coverage left join

medium

Keep all departments and include employee counts including zero-member groups.

3. Three-table staff view

medium

Join employees, departments, and jobs in one clean result set.

4. Missing-relationship audit

medium

Identify records with no matching lookup table rows.

5. Join multiplication defense

hard

Prevent duplicates by pre-aggregating line-item table before join.

6. Store order expansion

hard

Join orders, customers, and order_items with quality-safe counts.

7. Hospital appointment graph

medium

Join appointments to doctors and patients for operational reporting.

8. Join type comparison

easy

Compare INNER vs LEFT row counts and explain differences.

9. Key mismatch detector

hard

Create a query that flags suspicious foreign-key gaps across tables.

10. Production-ready join report

hard

Deliver a final join report with row-quality validation columns.

Study references

What to study next

Real data lives across multiple tables. Joins are how you bring it together. This course covers every join type so you always know exactly which rows will appear in your result — and which ones won't.

What you'll learn

  • INNER JOIN — only rows with a match in both tables
  • LEFT JOIN — all left-side rows; NULLs where there is no match on the right
  • RIGHT JOIN — the mirror of LEFT JOIN
  • FULL OUTER JOIN — everything from both sides, NULLs to fill gaps
  • Self-joins — joining a table to itself (classic use: employees and their managers)
  • Multi-table joins — chaining three or more tables in one query
  • ON vs USING — when to use each

What you'll practice on

The HR database (employees ↔ departments ↔ jobs) and the Store database (orders ↔ customers ↔ products). You'll answer questions that are simply impossible with a single table.

Prerequisites

SQL Fundamentals + Filtering & Logic. Aggregations & Grouping is helpful but not required.

Lessons · 4 total