how to select 2nd highest salary in mysql code example
Example 1: second max salary in sql
SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
Example 2: how to get employee having maximum experience in mysql
select max(salary), dept_id from employee where salary not in(select max(salary) from employee) group by dept_id;