Skip to course content
Free SQL course

SQL for Data Analysis and AI

Module 06

Subqueries and Common Table Expressions

About 75-95 minutes of guided work.

By the end of this module you can build a long query in stages that each prove themselves, name those stages with CTEs, choose between IN, EXISTS, and a join deliberately, and avoid the NOT IN bug that silently returns nothing.

Units

  1. Unit 06.00: Building a query in testable stages
  2. Unit 06.01: CTEs: naming each step so it can be checked
  3. Unit 06.02: Correlated subqueries and their real cost
  4. Unit 06.03: The NOT IN with NULL bug
  5. Unit 06.04: When a CTE changes meaning, not just readability

Module work