Database Reference
In-Depth Information
Figure 12.13
A Multilayer
Nested Subquery.
12.4.6
Inline Views
Demonstrating an inline view is simple. Let's modify the example used in Fig-
ure 12.13. In the example in Figure 12.13, only columns from the GENRE
table can be retrieved. In most cases, column values cannot be passed from
subquery to calling query, except for subqueries placed in the FROM clause.
This type of query is commonly known as an Inline View. Let's alter the
query in Figure 12.13 and retrieve a column value from each of the subque-
ries. The result of this following query is shown in Figure 12.14.
SELECT G.GENRE_ID, M.TITLE, M.TRACK_SEQ_NO
FROM GENRE G
, (SELECT MCD.GENRE_ID, MCD.TITLE, CD.TRACK_SEQ_NO
FROM MUSICCD MCD
, (SELECT MUSICCD_ID, TRACK_SEQ_NO FROM CDTRACK) CD
WHERE CD.MUSICCD_ID = MCD.MUSICCD_ID) M
WHERE M.GENRE_ID = G.GENRE_ID;
 
Search WWH ::




Custom Search