displaying 2nd to the highest code example
Example: 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
)