Cellwise · SQL track
Step by step with WITH
Break a hard query into named steps.
WITH lets you write a query, give its result a name, and then select from it as if it were a table. These named steps are called common table expressions, or CTEs.
They do the same job as LET in a spreadsheet: a long query becomes a series of short steps that each make sense.
What you’ll do
- Filter a summary
- Compare with a group average
- Find who beats their department