当前位置:网站首页>limit 与offset的用法(转载)
limit 与offset的用法(转载)
2022-07-07 21:54:00 【流楚丶格念】
limit 与offset的用法
在mysql中一般使用limit来实现分页
1、LIMIT后面跟一个参数,表示要提取的数量。
如 :select* from test LIMIT 3
指提取前三条数据,类似sqlServer的top语法。
2、LIMIT后面跟两个参数时,第一个参数是指第几行,第二个参数是取几条数据。
如: select * from test limit 2,3;
这个SQL是指从第二行的下一行开始向下取3条数据。(即取:3,4,5行的三条数据)
3、LIMIT和OFFSET组合使用时,LIMIT后面只能有一个参数,表示要提取的数量,offset后面的数字则表示第几行。
如:select * from test LIMIT 3 offset 2;
这个SQL是指从第二行的下一行开始向下取3条数据。(即取:3,4,5行的三条数据)
边栏推荐
- Dependency injection 2 advantage lifecycle
- Idea automatically generates serialVersionUID
- Pigsty: out of the box database distribution
- MP4文件格式解析之结合实例分析
- [summary] some panels and videos seen
- Jisuan Ke - t3104
- One click free translation of more than 300 pages of PDF documents
- P1308 [noip2011 popularity group] count the number of words
- Chisel tutorial - 04 Control flow in chisel
- 【汇总】看过的一些Panel与视频
猜你喜欢
受限线性表
Get started with mongodb
Chisel tutorial - 04 Control flow in chisel
激光slam学习(2D/3D、偏实践)
Take you hand in hand to build Eureka client with idea
P1067 [noip2009 popularity group] polynomial output (difficult, pit)
用语雀写文章了,功能真心强大!
C number of words, plus ¥, longest word, average value
ping报错:未知的名称或服务
Magic fast power
随机推荐
Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer
SAP HR reward and punishment information export
数据分析系列 之3σ规则/依据拉依达准则来剔除异常值
一键免费翻译300多页的pdf文档
Download AWS toolkit pycharm
网上买基金安全么?
Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
C语言学习
MongoDB快速入门
Navicat connects Oracle
Is it safe for tongdaxin to buy funds?
ASP. Net query implementation
一鍵免費翻譯300多頁的pdf文檔
一个测试工程师的7年感悟 ---- 致在一路独行的你(别放弃)
Magic fast power
One of the anti climbing methods
SQL uses the in keyword to query multiple fields
Oracle string sorting
数据湖(十五):Spark与Iceberg整合写操作
Rectification characteristics of fast recovery diode