Subqueries

A subquery is a SQL statement specifying a search condition that contains either a subselect or a fullselect, and is used inside another SQL statement. A subquery can include search conditions of its own. Each of these search conditions can also contain subqueries. Any SQL statement can contain a hierarchy of subqueries. The SQL query block that contains subqueries is at a higher level than the subqueries it contains. This is important for how columns are referenced between levels.

A subquery can contain search conditions that reference not only columns of the tables identified by its FROM clause, but also columns of tables identified at any higher level. A reference to a column of a table at a higher level is called a correlated reference ...

Get DB2® Universal Database for OS/390® Version 7.1 Certification Guide 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.