How do you select the second highest salaried employee?

Questioned on September 12, 2011
by admin
in SQL
Before answering this question, I assume you know how to select the first highest salaried employee. If not, here's what you need to do: SELECT * FROM Employee Having Salary = Max(Salary) Using the same logic above, you can use the following SQL statement for retrieving the second highest salaried employee. SELECT Top 1 * FROM Employee Where Salary < Max(Salary) Order By Salary DESC