get second highest salary in sql how much time it takes to write query for 6 Years experianced code example
Example 1: 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
)
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;