How to find 2nd highest salary in employee table while working in sql ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find 2nd highest salary in employee table while working in sql ??

Sql question

9th Jul 2020, 3:49 PM
Premlata Kumari
Premlata Kumari - avatar
2 Answers
+ 2
SELECT name, MAX(salary) AS salary FROM employee WHERE salary < (SELECT MAX(salary) FROM employee);
9th Jul 2020, 3:55 PM
Prabhjot Kaur
Prabhjot Kaur - avatar
+ 2
select the salary column from employee table in desencending order by salary, then limit the result to 1 starting from the 2nd column # its almost the answer
9th Jul 2020, 3:55 PM
Taste
Taste - avatar