Second highest salary using SQL

Kailash Singh

Second highest salary using SQL

Published Mar 07,2023 by Kailash Singh

0 Comment     840 Views    


In this tutorial, we are going to teach you, how to find Second highest salary using SQL.

 

For Example: You have a salary table and you have five users records in salary table and you need to find second highest salary in this table.

Demo Table: 

Second highest salary using SQL

 

Sql Query: 

SELECT MAX(emp_salary) 
FROM `salary` 
WHERE emp_salary 
NOT IN (SELECT MAX(emp_salary) FROM salary);

 

Result:


Comments ( 0 )