mysql - MYSQL LIMIT 关键字是否有 ANSI SQL 替代品?

标签 mysql database keyword ansi-sql

是否有 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/

相关文章:

php - PDO 中的表单更新数据

php - MySQL - 在数据库复杂性中查找表

c# - 处理大型数据库的最佳方式?

mysql - 将数据库从 Postgres 迁移到 MySQL

php - 在 PHP mySql 中按频率排序关键字

mysql - MySQL 中的动态交叉表查询

mysql - 如何等待 docker-entrypoint-initdb.d 在 Shell Script/Bash 中加载数据库?

database - 大公司(比如 Facebook)如何在不停机的情况下进行迁移?

node.js - 获取所有包含某个关键字的npm包

python - 如何在方法调用中的关键字 arg 之后使用非关键字 arg?