Suppose I have a table employee with id, user_name, salary. How can I select the record with the 2nd highest salary in Oracle?
I googled it, find this solution, is t
select * from emp where sal = ( select sal from (select rownum n,a.sal from ( select distinct sal from emp order by sal desc) a) where n = 2);
This is more optimum, it suits all scenarios...