select min(sal) from
(select sal from
(select sal from emp order by sal desc)
where rownum <=2
)
CONNECT BY clause and LEVEL pseudocolumn are useful for queries against tables containing hierarchical data. An example is the EMP table, an employee has a manager which also can have a manager and so on.
Although the query you posted is usable, using CONNECT BY and LEVEL in this context is rather matter of interest.
I'd preferably use the query posted by me at least for the performance reason.
SELECT DISTINCT SAL, TOP_SAL
FROM
(SELECT KEYWORD, DENSE_RANK() OVER(ORDER BY KEYWORD_ID DESC NULLS LAST) TOP_SAL
FROM EMP)
WHERE TOP_SAL <= 5; -- TOP 5 SAL.
Bookmarks