首页 / MYSQL / MYSQL LIMIT 用法详解
MYSQL LIMIT 用法详解
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了MYSQL LIMIT 用法详解,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1863字,纯文字阅读大概需要3分钟。
内容图文
![MYSQL LIMIT 用法详解](/upload/InfoBanner/zyjiaocheng/476/b8c3c1273df545c68564cf14c147e43c.jpg)
"//为了检索从某一个偏移量到记录集的结束所有的记录行,可以指定第二个参数为 -1:
mysql> SELECT * FROM table LIMIT 95,-1; // 检索记录行 96-last. "
写这句话的人自己肯定没有实际去操作,因为这是不对的。
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-1‘ at line 3
来看看mysql的官方文档:http://dev.mysql.com/doc/refman/6.0/en/select.html
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants(-1退下!), with these exceptions:
Within prepared statements, LIMIT parameters can be specified using ? placeholder markers.
Within stored programs, LIMIT parameters can be specified using integer-valued routine parameters or local variables.
With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15
To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:
SELECT * FROM tbl LIMIT 95,18446744073709551615;
With one argument, the value specifies the number of rows to return from the beginning of the result set:
SELECT * FROM tbl LIMIT 5; # Retrieve first 5 rows
In other words, LIMIT row_count is equivalent to LIMIT 0, row_count.
MYSQL LIMIT 用法详解
标签:retrieve manual tab store argument 用法详解 check table maximum
本文系统来源:http://www.cnblogs.com/winner-0715/p/6415430.html
内容总结
以上是互联网集市为您收集整理的MYSQL LIMIT 用法详解全部内容,希望文章能够帮你解决MYSQL LIMIT 用法详解所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。