01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 2 SQL AND PL/SQL 35<br />

<br />

<br />

<br />

The next three solutions, shown in Listing 2-15, use a mechanism called the correlated<br />

subquery <strong>to</strong> produce the same results as the previous solutions; correlated subqueries<br />

cannot be processed independently of the main query.<br />

Listing 2-15. Status of All Suppliers Who Supply Hammers—Examples of Correlated<br />

Subqueries<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Listing 2-16 uses a correlated subquery in conjunction with an aggregate function <strong>to</strong><br />

count quote records and determine whether the supplier under consideration supplies<br />

hammers.<br />

Listing 2-16. Status of All Suppliers Who Supply Hammers: An Example of Aggregation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!