Glossary · Phase 7 · Software engineering
Common table expression
A named step in a SQL query, written with WITH, that later steps can use like a table.
Try it now
SQL is written SELECT first but worked out in this order, which is why a WHERE can't use a column alias but ORDER BY can.
Learn it properly
SQL for analysis · Subqueries, CASE, common table expressions, outer joins and window functions on real order data. About 45 minutes.
Other terms from the same lesson
- anti-join: Finding rows with no match in another table, usually a LEFT JOIN followed by WHERE ... IS NULL.
- subquery: A query inside another query, which runs first and hands its result to the outer one.
- window function: A SQL calculation across a set of rows, like a rank or a running total, that keeps every row instead of grouping them.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.