first max salary in sql
snippet in sql

second max salary in sql

user1895

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);

first max salary in sql

user5316

SELECT first-name
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);

sql highest salary by location

user4566

/*  Highest salary by Department/Location   */
SELECT e.ename, e.sal, e.deptno, d.loc
FROM emp e
JOIN dept d
ON e.deptno = d.deptno
WHERE e.sal in
( 	
  	select max(sal) 
  	from emp 
  	group by deptno
)

second highest salary in sql

user566

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);


OR

Here is the solution for nth highest
salary from employees table 

SELECT FIRST_NAME , SALARY FROM 
(SELECT FIRST_NAME, SALARY, DENSE_RANK() OVER
(ORDER BY SALARY DESC) AS SALARY_RANK
FROM EMPLOYEES)
WHERE SALARY_RANK = n; 

how to get employee having maximum experience in mysql

user1104

select max(salary), dept_id from employee where salary not in(select max(salary) from employee) group by dept_id;