SQL Subqueries

This section discusses getting data based on unknown information (subqueries). Subqueries are useful when the condition of one query is based on information in another table. The syntax is as follows: SELECT column[s] FROM table[s] [(SELECT [column[s] FROM table[s] [WHERE...][GROUP BY ...] WHERE column|constant|expression operator (SELECT [column[s]] FROM table[s] [WHERE ...][GROUP BY ...]). You cannot use an ORDER BY in a subquery. The subquery is supplying row/column information to the outer query so there would be no reason to return rows in any particular order. Notice that you can have a subquery as part of the FROM clause.

Subqueries can be nested, or a subquery can contain a subquery. There is no technical limit to the depth ...

Get Oracle9i™ Development by Example 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.