Back to library

๐Ÿ”—Master SQL Joins and Query Relational Data with Confidence

See joins as set operations first, then write every join type against a real schema, tune them with indexes and query plans, and finish by solving ten realistic reporting queries.

Foundations14 drops~2-week path ยท 5โ€“8 min/daytechnology

Phase 1Joins as Set Operations

See joins as set operations on small tables

4 drops
  1. A join is set math on two tables

    6 min

    A join is set math on two tables

  2. INNER JOIN keeps only the overlap

    6 min

    INNER JOIN keeps only the overlap

  3. LEFT JOIN keeps every row on the left

    7 min

    LEFT JOIN keeps every row on the left

  4. RIGHT is LEFT backwards; FULL keeps everything

    6 min

    RIGHT is LEFT backwards; FULL keeps everything

Phase 2Every Join Against One Schema

Write every join type against one schema

5 drops
  1. One schema you'll use for the next five drops

    7 min

    One schema you'll use for the next five drops

  2. INNER JOIN across three tables at once

    7 min

    INNER JOIN across three tables at once

  3. LEFT JOIN when 'zero' is a valid answer

    7 min

    LEFT JOIN when 'zero' is a valid answer

  4. A table can join itself

    7 min

    A table can join itself

  5. CROSS JOIN multiplies every row by every row

    6 min

    CROSS JOIN multiplies every row by every row

Phase 3Joins, Indexes, and Query Plans

Tie joins to indexes, plans, and performance

4 drops
  1. Scenario: the join that got slow overnight

    8 min

    Scenario: the join that got slow overnight

  2. Scenario: every join column needs an index โ€” or does it?

    8 min

    Scenario: every join column needs an index โ€” or does it?

  3. Scenario: filter in ON or filter in WHERE?

    8 min

    Scenario: filter in ON or filter in WHERE?

  4. Scenario: the row count that doubled mysteriously

    8 min

    Scenario: the row count that doubled mysteriously

Phase 4Ten Realistic Reporting Queries

Solve ten realistic reporting queries end-to-end

1 drop
  1. Ten reporting queries against a real-looking schema

    25 min

    Ten reporting queries against a real-looking schema

Frequently asked questions

What's the difference between INNER JOIN and LEFT JOIN?
This is covered in the โ€œMaster SQL Joins and Query Relational Data with Confidenceโ€ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
When should I use a FULL OUTER JOIN?
This is covered in the โ€œMaster SQL Joins and Query Relational Data with Confidenceโ€ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Why is my LEFT JOIN returning duplicate rows?
This is covered in the โ€œMaster SQL Joins and Query Relational Data with Confidenceโ€ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
How do indexes affect join performance?
This is covered in the โ€œMaster SQL Joins and Query Relational Data with Confidenceโ€ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
What does a CROSS JOIN actually do?
This is covered in the โ€œMaster SQL Joins and Query Relational Data with Confidenceโ€ learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.