Oracle: Top 5 entries with LIMIT / ROWNUM

This entry was posted by on Thursday, 14 May, 2009 at

In short: the correct way is to nest a select with a ROWNUM < X around it.
Example:

select *
from
(
select *
from emp
order by sal desc
)
where ROWNUM <= 5;

In more detail: Ask Tom

One Response to “Oracle: Top 5 entries with LIMIT / ROWNUM”

  1. Thank you for useful information.


Leave a Reply