SQL TOP子句

1.TOP子句

——用于规定要返回的记录数目

SELECT TOP number|percent column_name(s)
FROM table_name

2.Oracle语法

SELECT column_name(s)
FROM table_name
WHERE ROWNUM <= number
例如:
SELECT *
FROM Persons
WHERE ROWNUM <= 5

选取头两条记录:
select top 2 *
from Persons

选取50%的记录:
select 50 percent *
from persons
posted @ 2020-07-08 09:54  柒久酒  阅读(138)  评论(0编辑  收藏  举报