SELECT * FROM table LIMIT [offset,] rows | rows OFFSET offset
使用查询语句的时候,要返回前几条或者中间某几行数据,用Llimit 可以实现:
1. LIMIT 子句可以被用于强制 SELECT 语句返回指定的记录数。
LIMIT 接受一个或两个数字参数。参数必须是一个整数常量。如果给定两个参数,第一个参数指定第一个返回记录行的偏移量,第二个参数指定返回记录行的最大数目。初始记录行的偏移量是 0(而不是 1): 为了与 PostgreSQL 兼容,MySQL 也支持句法: LIMIT # OFFSET #。
2.//检索记录行6-15
mysql> SELECT * FROM table LIMIT 5,10;
3. //为了检索从某一个偏移量到记录集的结束所有的记录行,可以指定第二个参数为 -1:
// 检索记录行 96-last.
mysql> SELECT * FROM table LIMIT 95,-1;
4. //如果只给定一个参数,它表示返回最大的记录行数目:
//检索前 5 个记录行
mysql> SELECT * FROM table LIMIT 5;
//换句话说,LIMIT n 等价于 LIMIT 0,n。
版权属于: 三三世界-百宝箱
本文链接: http://33f.net/linux/sql_limit_line.html
本文最后更新于2022年03月26日 ,已超过1001天没有更新,若内容或图片失效,请留言反馈。
本文允许转载,但请在转载时请以超链接或其它形式标明文章出处
@Doug Shume it's ok for me , you can post here.
Saved as a favorite, I like your website!
If some one wishes to be updated with hottest technologies after that he must be visit this site and be up to date daily.
Heello would you mind sharing which blog platform you're using? I'm planning to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then moost blogs and I'm looking for something completely unique. P.S Apologies forr being off-topic butt I had to ask!
Thanks to my father who shared with me regarding this webpage, this website is genuinely amazing.
Hi, I have an overflow of customers that I'd like to send to you but I want to make sure you can handle more leads, let me know if you'd like me to send you more info.
zh.us.to 有效
kms.03k.org 有效
kms.chinancce.com
kms.shuax.com 有效
kms.dwhd.org 有效
kms.luody.info 有效
kms.digiboy.ir 有效
kms.lotro.cc 有效
www.zgbs.cc 有效
cy2617.jios.org 有效
@ 权限问题,试试sudo 再加命令。
你好提示Permission denied 怎么办啊