Database Reference
In-Depth Information
Figure 12.14
A Multilayer
Nested Inline View
(FROM Clause
Subquery).
The query in Figure 12.14 has many more rows than the query in Figure
12.13 because Figure 12.14 retrieves the join between the three tables and
Figure 12.13 represents on DISTINCT genres from the GENRE table.
12.4.7
Other Uses for Subqueries
We have already seen that subqueries can be used in many places, syntacti-
cally speaking, as listed previously in this chapter.
Note: In Oracle Database 8 i , use of subqueries was limited. In Oracle Data-
base 9 i and Oracle Database 10 g , restrictions are almost completely lifted.
Two significant uses of subqueries not covered in this chapter so far are
DML command subqueries, as in the INSERT and UPDATE statements.
Placing subqueries in the VALUES clause of an INSERT statement and in
UPDATE statements can be useful. Be aware of performance impact when
using subqueries in ORDER BY clauses, CASE statement expressions, the
SPREADSHEET clause, and as function parameters. Here is an example of
an INSERT statement with a subquery that returns the ARTIST_ID of
Search WWH ::




Custom Search