What is the query to find nth highest salary from employee table? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the query to find nth highest salary from employee table?

14th Apr 2017, 4:35 PM
Amol Pawar
Amol Pawar - avatar
10 Answers
+ 2
i think aggregation function is tobe used... select max(salary)..
15th Apr 2017, 5:14 AM
Amol Pawar
Amol Pawar - avatar
+ 2
simple use select max(salary) from faculty;
1st Jun 2017, 12:42 PM
Mayur Chaudhari
Mayur Chaudhari - avatar
+ 2
there is logic required for find second or third maximum salary from table
1st Jun 2017, 12:42 PM
Mayur Chaudhari
Mayur Chaudhari - avatar
+ 1
This will work but there might be something simpler : Select * from (select * from EMPLOYEES order by Salary desc limit 5) order by Salary limit 1
14th Apr 2017, 8:06 PM
1of3
1of3 - avatar
+ 1
I would use something like this: select salary from employee where salary > 0 order by salary desc; This should give you a list of salaries, largest to smallest.
16th Apr 2017, 4:03 AM
Donald Malewitz
Donald Malewitz - avatar
+ 1
select * from employee order by salary desc limit nth , 1
21st Apr 2017, 6:29 AM
SHREEKRISHNA SHANKHWAR
SHREEKRISHNA SHANKHWAR - avatar
+ 1
in ques. we hav to find a specific salary...not a list
21st Apr 2017, 8:23 AM
Amol Pawar
Amol Pawar - avatar
+ 1
select salary from employ where salary =max
22nd Aug 2017, 2:20 PM
Selva Raj
Selva Raj - avatar
0
selva raj has written the correct answer
5th Nov 2017, 2:50 AM
Jayesh Malviya M
Jayesh Malviya M - avatar
0
select * employee order by salary DESC
5th Nov 2017, 2:53 AM
Jayesh Malviya M
Jayesh Malviya M - avatar