Databases
🪆 Subqueries and CTEs
Nest queries to answer complex questions: scalar subqueries and subqueries in WHERE, correlated EXISTS and CTEs with WITH.
What you'll learn
- Nest scalar subqueries and use them in
WHEREwithINandNOT IN - Build correlated subqueries and check existence with
EXISTS/NOT EXISTS - Structure readable queries with CTEs (
WITH ... AS) and chain several - Traverse hierarchies and generate series with
WITH RECURSIVE
Lessons
Scalar subqueries and subqueries in WHEREUse the result of one query inside another: compare against a computed value and with IN. EXISTS and correlated subqueriesSubqueries that reference the outer row and EXISTS to check existence. CTEs with WITHName a subquery with WITH to make the query readable and reusable.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →