Index Ai Academy
Glossary · Phase 7 · Software engineering

Subquery

Also written: subqueries

A query inside another query, which runs first and hands its result to the outer one.

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