Query to find 2nd max salary

Select first_name,last_name,salary from employees order by salary desc;

Query to find 2nd maximum salary


SELECT MAX(salary)
FROM employees
WHERE salary NOT IN (SELECT MAX(salary) FROM employees);

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *