Databases Reference
In-Depth Information
SELECT * FROM (
SELECT S.*,
DENSE_RANK() OVER (ORDER BY AMOUNT_SOLD DESC) AS RANKING
FROM sh.SALES S
) WHERE ROWNUM < 11;
SET TIMING OFF
The output is as follows:
See also
F
There's more on subqueries in
Chapter 4
,
Optimizing SQL Code
in the
Using
subqueries
recipe