Database Reference
In-Depth Information
Figure 5.7
AND Has Higher
Precedence than
OR.
ORDER BY RECORDING_DATE)
WHERE ROWNUM <= 10;
(first 10) rows of the query
in the Inline view. Use Top-N queries, for instance, in a large data ware-
house database where you simply want a sample of the data.
The only additional issue worth mentioning is that a Top-N query only
retrieves the first
Thus the query retrieves the Top-N or first
n
rows.
Therefore, changing the WHERE clause to the following query would run
successfully, but no rows would be returned.
n
rows and cannot be used to retrieve the last
n
WHERE ROWNUM
>
10;
That more or less covers the basics of WHERE clause filtering of
SELECT statement results. There are a few other points to remember about
using WHERE clauses:
The WHERE clause is evaluated before the result of a row set being
returned. In other words, the WHERE clause is applied to and affects
physical input/output (I/O) disk reads. The WHERE clause can
therefore affect SELECT statement performance drastically because it
 
Search WWH ::




Custom Search