--查询工资最高的三位人员信息
SELECT TOP 3 * FROM emp ORDER BY salary DESC
--查询工资由低到高排序好的第3到第5条记录
SELECT * FROM
(SELECT ROW_NUMBER() OVER(ORDER BY salary DESC) AS RowNumber,* FROM emp) AS C
WHERE C.RowNumber>=3 AND C.RowNumber<=5
查询结果截图如下:
--查询工资最高的三位人员信息
SELECT TOP 3 * FROM emp ORDER BY salary DESC
--查询工资由低到高排序好的第3到第5条记录
SELECT * FROM
(SELECT ROW_NUMBER() OVER(ORDER BY salary DESC) AS RowNumber,* FROM emp) AS C
WHERE C.RowNumber>=3 AND C.RowNumber<=5
查询结果截图如下: