在MySQL中将LIMIT和OFFSET一起使用时,返回哪些行? [英] Which rows are returned when using LIMIT with OFFSET in MySQL?

查看:67
本文介绍了在MySQL中将LIMIT和OFFSET一起使用时,返回哪些行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的查询中:

SELECT column 
FROM table
LIMIT 18 OFFSET 8

我们将获得多少结果以及从哪里到哪里?

how many results will we get as output and from where to where?

推荐答案

从记录#9开始到记录#26结束,它将返回18个结果.

It will return 18 results starting on record #9 and finishing on record #26.

首先从offset中读取查询.首先,您要偏移8,这意味着您跳过了查询的前8个结果.然后限制为18.这意味着您考虑记录9、10、11、12、13、14、15、16 .... 24、25、26,它们总共为18条记录.

Start by reading the query from offset. First you offset by 8, which means you skip the first 8 results of the query. Then you limit by 18. Which means you consider records 9, 10, 11, 12, 13, 14, 15, 16....24, 25, 26 which are a total of 18 records.

检查.

官方文档.

这篇关于在MySQL中将LIMIT和OFFSET一起使用时,返回哪些行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆