• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
July 08, 2022 |71.2K Views
Nth highest salary
  Share   Like
Description
Discussion

Finding Nth highest salary in a table is the most common question asked in interviews. Here is a way to do this task using dense_rank() function. 
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.


Nth highest salary : https://www.geeksforgeeks.org/find-nth-highest-salary-table/

Read More