1#2nd Most highest salary using Limit & Order By
2SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS Emp ORDER BY salary LIMIT 1;
1#2nd Most highest salary using Group By, Order By & Limit clause
2SELECT sal FROM emp GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
1#2nd Most highest salary using dense_rank()
2SELECT sal
3FROM (SELECT dense_rank() over(ORDER BY sal DESC) AS R, sal FROM emp) employee
4WHERE R = 2;
1#Corelated Subquery
2SELECT Id, Salary
3FROM Employee e
4WHERE 2=(SELECT COUNT(DISTINCT Salary) FROM Employee p
5WHERE e.Salary<=p.Salary)