Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

nth highest salary in sql

select * from(
select ename, sal, dense_rank() 
over(order by sal desc)r from Employee) 
where r=&n;

To find to the 2nd highest sal set n = 2
To find 3rd highest sal set n = 3 and so on.
 
PREVIOUS NEXT
Tagged: #nth #highest #salary #sql
ADD COMMENT
Topic
Name
3+8 =