This is a very simple SQL query for finding the 2nd highest salary from an employee table.
A very common question in .NET interviews. The query is pretty self explanatory.
select top(1)[Name],Salary from Employee
where salary not in (select top (1) salary from employee order by salary desc) ORDER BY SALARY DESC
– Change the top parameter to (nth highest salary - 1)