是否有 ANSI SQL 替代 MYSQL LIMIT 关键字?
LIMIT 关键字限制 SELECT 返回的行数,例如:
SELECT * FROM People WHERE Age > 18 LIMIT 2;
返回 2 行。
SELECT * FROM People WHERE Age > 18 LIMIT 10, 2;
在前 10 行之后返回 2 行。
最佳答案
this shows the different ways:
-- DB2
select * from table fetch first 10 rows only
-- Informix
select first 10 * from table
-- Microsoft SQL Server and Access
select top 10 * from table
-- MySQL and PostgreSQL
select * from table limit 10
-- Oracle
select * from (select * from table) where rownum <= 10
关于mysql - MYSQL LIMIT 关键字是否有 ANSI SQL 替代品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/595123/