second highest salary in mysql
snippet in sql

2nd highest salary in mysql


#2nd Most highest salary using Limit & Order By
SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS Emp ORDER BY salary LIMIT 1;

sql select second max


Both options you find max as a subset and then exclude from main select
sql> SELECT MAX( col ) FROM table
 	WHERE col < ( SELECT MAX( col ) FROM table);
sql> SELECT MAX(col) FROM table 
WHERE col NOT IN (SELECT MAX(col) FROM table);

second highest salary in mysql


SELECT name, MAX(salary) AS salary
  FROM employee
 WHERE salary < (SELECT MAX(salary)
                 FROM employee); 

sql highest salary by location


/*  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

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;