12.11. SQL: Correlated and Existential Subqueries
This section extends the subquery work in Section 12.8 by considering correlated and existential subqueries. The subqueries discussed earlier were simple, uncorrelated sub-queries. An uncorrelated subquery is computed once, replaced by its result, and the outer query is run. In contrast, a correlated subquery relates its search condition to each row of a table named in the outer query and is effectively recomputed for each outer row (see Figure 12.58).
Figure 12.58. A correlated subquery relates its condition to each row of the outer query.
Because of repeated computation, correlated subqueries ...
Get Information Modeling and Relational Databases, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.