当前位置:网站首页>Usage of limit and offset (Reprint)

Usage of limit and offset (Reprint)

2022-07-07 23:57:00 Liu Chu, Ge Nian

limit And offset Usage of

stay mysql Generally used in limit To implement paging

1、LIMIT Followed by a parameter , Indicates the quantity to be extracted .

Such as :select* from test LIMIT 3 It refers to extracting the first three data , similar sqlServer Of top grammar .

2、LIMIT When followed by two parameters , The first parameter refers to the number of lines , The second parameter is to take several pieces of data .

Such as : select * from test limit 2,3; This SQL It refers to taking down... From the next line of the second line 3 Data .( Take away :3,4,5 Three lines of data )

3、LIMIT and OFFSET In combination ,LIMIT Only one parameter can be followed , Indicates the quantity to be extracted ,offset The following number indicates the line .

Such as :select * from test LIMIT 3 offset 2; This SQL It refers to taking down... From the next line of the second line 3 Data .( Take away :3,4,5 Three lines of data )

原网站

版权声明
本文为[Liu Chu, Ge Nian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207072148476048.html