Here I am writing SQL query to find nth salary
without using top or max keywords.
SELECT
* FROM
(
SELECT
ROW_NUMBER()
OVER (ORDER
BY SALARY DESC)
AS rownumber,Salary
FROM
Employee )
AS
foo
WHERE
rownumber = n
Example
SELECT
* FROM
(
SELECT
ROW_NUMBER()
OVER (ORDER
BY SALARY DESC)
AS rownumber,Salary
FROM
Employee )
AS
foo
WHERE
rownumber = 5
The above query will show 5th highest salary from Employee table.