是否有一个ANSI SQL替代MYSQL LIMIT关键字? [英] Is there an ANSI SQL alternative to the MYSQL LIMIT keyword?

查看:249
本文介绍了是否有一个ANSI SQL替代MYSQL LIMIT关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有ANSI SQL替代MYSQL LIMIT关键字?

Is there an ANSI SQL alternative to the MYSQL LIMIT keyword?

LIMIT关键字限制SELECT返回的行数,例如:

The LIMIT keyword limits the number of rows returned by a SELECT e.g:

SELECT * FROM People WHERE Age > 18 LIMIT 2;

返回2行。

SELECT * FROM People WHERE Age > 18 LIMIT 10, 2;

在前10个后返回2行。

returns 2 rows after the first 10.

推荐答案

这显示了不同的方式: / a>

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

这篇关于是否有一个ANSI SQL替代MYSQL LIMIT关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆