Nth The highest salary is where there are higher N-1 salaries. For example. highest salary does not have higher salaries
Performing the following query change should demonstrate how this works:
SELECT * FROM Employee Emp1
CROSS APPLY
(
SELECT COUNT(DISTINCT(Emp2.Salary)) AS NHigher
FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary
) X;
The script for Sql Server is here
, , RDBMS OFFSET LIMIT, N- ORDER BY.
. SQL Server 2012 2- :
SELECT *
FROM Employee Emp1
ORDER BY SALARY DESC
OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY;