nothing<\/em> that guarantees this. Result order can change as statistics get updated, as index trees are reshuffled, as data is partitioned across different physical machines so that result order depends on network latencies ...<\/p>\nSo if you want pagination then make sure you ORDER BY on something guaranteed to be UNIQUE, or live with the fact that the sort order of identical values in a non-unique sequence is not deterministic and can change at any time without prior notice.<\/p>\n
Your example is equivalent to<\/p>\n
SELECT * FROM table ORDER BY 'x';<\/p>\n
( not the same as "ORDER BY 1" as that would be 'order by the first result column )<\/p>\n
and almost equivalent to<\/p>\n
SELECT * FROM table ORDER BY RAND();<\/p>\n
and you wouldn't expect that to return the same row order every time either, would you?<\/p>\n<\/blockquote>\n
\u30e6\u30cb\u30fc\u30af\u3067\u306a\u3044\u30ab\u30e9\u30e0\u306eORDER BY\u3067\u306f\u3001\u7d50\u679c\u306e\u9806\u5e8f\u306f\u4e0d\u5b9a\u3068\u3044\u3046\u306e\u304cMySQL\u306e\u4ed5\u69d8\u3067\u3059\u3002
\n\u5f15\u7528\u4f8b\u306b\u66f8\u3044\u3066\u3042\u308b\u3088\u3046\u306b\u3001\u30e6\u30cb\u30fc\u30af\u3067\u306a\u3044\u30ab\u30e9\u30e0 x<\/code> \u306b\u5bfe\u3057\u3066<\/p>\nSELECT * FROM table ORDER BY 'x';<\/code><\/pre>\n\u3068\u3044\u3046SQL\u3092\u767a\u884c\u3059\u308b\u306e\u306f\u307b\u307c<\/p>\n
SELECT * FROM table ORDER BY RAND();<\/code><\/pre>\n\u3068\u540c\u69d8\u3067\u3059\u3002\u3053\u306e\u4f8b\u3067\u3042\u308c\u3070\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u3057\u3066\u3082\u6bce\u56de\u9055\u3046\u30c7\u30fc\u30bf\u304c\u8fd4\u308b\u3053\u3068\u304c\u611f\u899a\u7684\u306b\u5206\u304b\u308a\u3084\u3059\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n
\u3057\u305f\u304c\u3063\u3066\u3001\u57fa\u672c\u7684\u306b\u306f\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3068ORDER BY\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u969b\u306b\u306f\u30e6\u30cb\u30fc\u30af\u306a\u30ab\u30e9\u30e0\u3067\u30bd\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u5fc5\u8981\u3067\u3059\u3002\u4eca\u56de\u306fMySQL\u306e\u4f8b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u3001Oracle\u3067\u3082PostgreSQL\u3067\u3082\u91cd\u8907\u304c\u8fd4\u308b\u53ef\u80fd\u6027\u306f\u3042\u308a\u307e\u3059\u3002<\/p>\n
\u3053\u308c\u306f\u57fa\u672c\u7684\u306a\u8a71\u306a\u306e\u3067\u3059\u304c\u3001\u3082\u3057\u4f5c\u308a\u8fbc\u3093\u3067\u3057\u307e\u3046\u3068\u4e00\u898b\u52d5\u3044\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u308b\u5206\u304b\u308a\u3065\u3089\u3044\u30d0\u30b0\u3068\u306a\u308b\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3001ORDER BY, LIMIT, OFFSET\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u969b\u306b\u306fORDER BY\u304c\u30e6\u30cb\u30fc\u30af\u30ab\u30e9\u30e0\u306b\u52b9\u3044\u3066\u3044\u308b\u304b\u304d\u3061\u3093\u3068\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n
\u3068\u30a8\u30e9\u305d\u3046\u306b\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u5148\u65e5\u601d\u308f\u306c\u3068\u3053\u308d\u3067\u3053\u306e\u30d0\u30b0\u3092\u4f5c\u308a\u8fbc\u3093\u3067\u3044\u305f\u305f\u3081\u3001\u81ea\u6212\u3092\u8fbc\u3081\u305f\u8a18\u4e8b\u3067\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u4e0b\u689d\u3067\u3059\u3002\u4eca\u65e5\u306fSQL\u306e\u8efd\u3044 (\u3057\u304b\u3057\u91cd\u8981\u306a) \u8a71\u984c\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002 \u307e\u305a\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u30e6\u30cb\u30fc\u30af\u3067\u306a\u3044 col \u30ab\u30e9\u30e0\u3092\u542b\u3080 test \u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u3001\u30c7\u30fc\u30bf\u3092\u6295\u5165\u3059\u308bSQL\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002 (MySQL\u3067\u306e\u4f8b\u3067\u3059\u3002) create table test(id INT, col INT); insert into test values(1,1); insert int […]<\/p>\n","protected":false},"author":4,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/444"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}