gpt4 book ai didi

mysql select default order with limit select * from mytable limit m, n;

转载 作者:行者123 更新时间:2023-11-29 14:14:38 25 4
gpt4 key购买 nike

在 mysql 中,如果你这样做

select * from mytable limit m, n;

假设表没有改变(没有添加删除,但有一些更新),你总是会得到相同的行吗?例如,如果您这样做

select * from mytable limit 10000, 10000

从不同的客户端/线程,您会始终得到相同的结果吗?

最佳答案

如第 20.2 节 <直接选择语句:多行> 的“一般规则”小节所述 SQL-92 specification :

4) If an <order by clause> is not specified, then the ordering of   the rows of Q is implementation-dependent.

我可以在 MySQL 手册中找到关于这一点的最佳特定于实现的文档位于 Sorting Rows 下。 :

You may have noticed in the preceding examples that the result rows are displayed in no particular order. It is often easier to examine query output when the rows are sorted in some meaningful way. To sort a result, use an ORDER BY clause.

只要说没有明确的相反文档,就不能依赖 MySQL 一致地以相同的顺序返回记录,除非给出适当的显式 ORDER BY 子句(尽管根据我的经验,它总是一致的)。

关于mysql select default order with limit select * from mytable limit m, n;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12878507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com