liveBook · Manning

Nested query

A nested query is a query embedded within another query or statement whose result participates in evaluating the containing operation.

How 2 Manning books explain it

Learn SQL in a Month of Lunches

A subquery is an SQL query nested within another SQL statement whose result can supply data for joining, filtering, or other operations.

How it is used
Combines multiple SELECT results into one statement for filtering, comparisons, and joins.
How deep it goes
Demonstrates WHERE, FROM, and SELECT placements plus multirow operators, while warning that SELECT-clause subqueries are rarely best.
Examples
Uses customer orders, titles in order 1034, Joe Pagenaud, Cora Daly, and the longest title name.
What you can do after
Apply it via SQL operators to filter, exclude, compare, and join results returned by nested SELECT statements.

Read how Learn SQL in a Month of Lunches explains nested query →

DuckDB in Action

A subquery is a query nested inside another SQL statement or expression.

How it is used
Stages analytical computations, filters rows against inner results, and prepares values for comparisons.
How deep it goes
Explains uncorrelated, scalar, correlated, and set-comparison forms with runnable examples, while deferring broader query optimization.
Examples
Demonstrates per-system power aggregation, maximum-reading filters, correlated maxima, joins, EXISTS, IN, ANY, and ALL.
What you can do after
Apply it in DuckDB to stage aggregates, filter by scalar results, correlate inner queries, and test membership or inequality across result sets.

Read how DuckDB in Action explains nested query →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.