I have tried the below query:
select empno from (
select empno
from emp
order by sal desc
)
where rownum = 2
This is not returning any records.
When I tried this query
select rownum,empno from (
select empno from emp order by sal desc)
It gives me this output:
ROWNUM EMPNO
1 7802
2 7809
3 7813
4 7823
Can anyone tell me what's the problem with my first query? Why is it not returning any records when I add the ROWNUM filter?