Top 10 rows in Oracle

In previous versions of Oracle, we had to retrieve a top10 rows via a sub query. In the sub query, we ordered and retrieved the data whereas in the main query, we could retrieve 10 top rows. Something like:

select * from
(select * from hr.employees order by salary desc)
where rownum <=10;

Oracle 12 introduced a new concept that yields the same results:

select * from hr.employees order by salary desc
fetch first 10 rows  with ties;

Pretty, isn’t it?

Door tom