admin asked a Question in SQL

How do you select the second highest salaried employee?

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

Updated September 12, 2011