Tested it, when the table has the specified field after PRIMARY KEY 的时候根据PRIMARY KEY 来排序,如果没有,则根据TABLE_INDEX 来排序,楼主方便贴一下SHOW INDEX FROM table 结果吗?不过建议使用 ORDER BY xx LIMIT xx 根据ORDER BY sorting, it is clear at a glance, concise and easy to understand.
Explain these two SQL statements and see if the type and key values are different. The guess is that different sorting methods are used according to the query columns (maybe the optimal sorting method judged by mysql itself). So it's best to add order by. To avoid finding duplicate data, the questioner can try your two SQL statement query fields and add one less query. The sorting results may be different. For the paging situation of the title, it is better to add order by. Generally, order by is added to paging.
If there is no primary key and no sorting is specified, it will be chaotic; if there is a primary key, the primary key sorting will be defaulted. Without a primary key, if you want the data to be stable, you must specify the sorting field
Tested it, when the table has the specified field after
PRIMARY KEY
的时候根据PRIMARY KEY
来排序,如果没有,则根据TABLE_INDEX
来排序,楼主方便贴一下SHOW INDEX FROM table
结果吗?不过建议使用ORDER BY xx LIMIT xx
根据ORDER BY
sorting, it is clear at a glance, concise and easy to understand.Explain these two SQL statements and see if the type and key values are different. The guess is that different sorting methods are used according to the query columns (maybe the optimal sorting method judged by mysql itself). So it's best to add order by. To avoid finding duplicate data, the questioner can try your two SQL statement query fields and add one less query. The sorting results may be different. For the paging situation of the title, it is better to add order by. Generally, order by is added to paging.
You didn’t specify the sorting column. The order by field is necessary to make sense. Otherwise, of course, you will just give a few randomly.
Look at the index used
Maybe it is sorted according to the index
If there is no primary key and no sorting is specified, it will be chaotic; if there is a primary key, the primary key sorting will be defaulted. Without a primary key, if you want the data to be stable, you must specify the sorting field