Subqueries & CTEs
Learn SQL subqueries & ctes with practical examples and guided drills on dbSyntax.
Start with Subqueries (IN / EXISTS)Subqueries (IN / EXISTS)
IntermediateA subquery is a SELECT inside another SELECT. Three shapes show up over and over: | Form | Returns | Used in | | --- | --- | --- | | col IN ...
Correlated Subqueries
IntermediateA correlated subquery is an inner query that references a column from the outer row. Logically, it's evaluated once per outer row: the inner...
WITH (CTEs)
IntermediateA Common Table Expression is a subquery you name at the top of your query and reference like a table below it....