February 2025
Beginner
304 pages
8h 8m
English
In chapter 10, we expanded the scope of our thinking a bit. We saw how to use SQL not only to query tables but also, with the help of set operators such as UNION or INTERSECT, to combine the results of two or more SELECT statements to form a single result set. In this chapter, we’ll build on that knowledge by examining an important method of evaluating the results of multiple SELECT statements in the same query: the subquery.
Subqueries are simply queries nested into another query. We use subqueries when we can’t achieve the desired results from a single SELECT statement, so instead of writing two or more queries, we combine them into a single query. Don’t worry—this process isn’t as complicated as it ...