Index Ai Academy
Glossary · Phase 7 · Software engineering

Common table expression

Also written: CTE, CTEs

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.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write