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 ( select EmployeeID, Salary , dense_rank() over (order by Salary DESC) ranking from Employee ) WHERE ranking = 2;
dense_rank() is used for the salary has to be same.So it give the proper output instead of using rank().