AI engineering glossary · SQL databases

What is subquery?

Subquery (also called Nested query): A query nested inside another query, in the WHERE, FROM or SELECT part. The inner query's result feeds the outer one. It lets you break a problem into steps without creating temporary tables.

Level: intermediateTopic: SQL databases

Subquery: an example

WHERE amount > (SELECT AVG(amount) FROM orders) keeps orders above the average value.

Related terms

More SQL databases terms

Where you learn it

Subquery is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.