To this point, I’ve used a single
SELECT statement to retrieve data from one or more tables. This chapter describes nested queries, which let you retrieve or modify data based on another query’s result.
A subquery, or subselect, is a
SELECT statement embedded in another SQL statement. You can nest a subquery in:
HAVING clause of a
In general, you can use a subquery anywhere an expression is allowed, but your DBMS might restrict where they can appear. This chapter covers subqueries nested in a
SELECT statement or another subquery; Chapter 10 covers subqueries embedded in