Subqueries
A subquery is just a query contained inside another query. You can call the subquery an inner query contained within an outer query, which in turn can be a standard query or another subquery.
If you think about standard queries, you can define three kinds of queries, according to the type of result they provide:
Scalar—Queries that produce a single value (one single row with only one column)
List—Queries that produce a list of values (one or more rows with a single column only)
Array—Queries that return a result set (one or more rows with one or more columns)
List queries can be considered single-column array queries. Scalar queries can be used as single-column, single-row array queries as well.
Listing 11.1 shows different scalar queries ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access