Sunday, April 24, 2016

Find out the nth-highest salary from table

select * from 
(
    select sal, rank() over (order by sal DESC/ASC) rnk 
    from emp
) 
where rnk = 1/2/3/4/5/6/...;