当前位置:网站首页>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行的三条数据)
边栏推荐
猜你喜欢
Ping error: unknown name or service
Uic564-2 Appendix 4 - flame retardant fire test: flame diffusion
MySQL Architecture
Archery installation test
Take you hand in hand to build feign with idea
光流传感器初步测试:GL9306
一鍵免費翻譯300多頁的pdf文檔
About the difference between ch32 library function and STM32 library function
ASP. Net core middleware request processing pipeline
How did a fake offer steal $540million from "axie infinity"?
随机推荐
[summary] some panels and videos seen
Flash download setup
【路径规划】使用垂距限值法与贝塞尔优化A星路径
C method question 1
Kubectl 好用的命令行工具:oh-my-zsh 技巧和窍门
Laser slam learning (2d/3d, partial practice)
C simple question one
平衡二叉樹【AVL樹】——插入、删除
通达信买基金安全吗?
Reverse output three digit and arithmetic sequence
Ora-02437 failed to verify the primary key violation
May day C - most
Jisuan Ke - t3104
SAP HR labor contract information 0016
Restricted linear table
Dependency injection
The file format and extension of XLS do not match
C语言学习
HDU - 1260 Tickets(线性DP)
【leetcode】day1