how to get second max salary in sql


select min(sal) as sal from emp where sal   in 
(select distinct top 2 sal from emp with (nolock) order by sal desc ) 


---------------------------------



SELECT TOP 1 sal
FROM  emp where  sal not in(SELECT MAX(sal) FROM emp)
 order by sal  desc


---------------------------------


select sal from emp e where
2 =(select count(distinct sal) from emp where e.sal<=sal)


-------------------------------


SELECT MAX(SAL) FROM emp WHERE SAL<(SELECT MAX(SAL) 
FROM emp)