1SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
2WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
1/* sql 2nd highest salary employee */
2select sal, ename
3from emp
4where sal =
5 (
6 select max(sal) from emp where sal <
7 (select max(sal) from emp)
8 )
9----------------------------------------------- option 2
10select *
11from
12(
13 select ename, sal, dense_rank() over(order by sal desc) rank
14 from emp
15)
16where rank =2;
1SELECT MAX(salary) FROM Employee WHERE Salary NOT IN ( SELECT Max(Salary) FROM Employee);