Write a SQL query to get the second highest salary from the Employee table.
| Id | Salary | | 1 | 100 | | 2 | 200 | | 3 | 300 | <
I would use DENSE_RANK() & do LEFT JOIN with employee table :
DENSE_RANK()
LEFT JOIN
SELECT t.Seq, e.* FROM ( VALUES (2) ) t (Seq) LEFT JOIN (SELECT e.*, DENSE_RANK() OVER (ORDER BY Salary DESC) AS Num FROM Employee e ) e ON e.Num = t.Seq;