Subqueries

Subqueries are SELECT statements that retrieve values from the database. The subquery then supplies the values as an argument in a calling SELECT statement. Subqueries that return actual values to the calling SELECT statement are executed before the calling SELECT statement is executed. Correlated subqueries are another type that is executed once for each potential record that the calling SELECT statement retrieves. Correlated subqueries test for existence and return a Boolean value to the calling SELECT statement. If the Boolean is false, the calling SELECT statement discards the record.

Subqueries are also used with DML commands such as INSERT to create a set of records that can be added to a table. We have also seen (in Chapter ...

Get Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts 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.