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
If you're using Oracle 8+, you can use the RANK() or DENSE_RANK() functions like so
RANK()
DENSE_RANK()
SELECT * FROM ( SELECT some_column, rank() over (order by your_sort_column desc) as row_rank ) t WHERE row_rank = 2;