When I do SELECT STATEMENT MySQL sorts by name, not by primary key. I understand that I can add "order by id", but I want to make sure that sql sorts by primary key by default
Asked
Active
Viewed 27 times
0
-
3Results from a SELECT are NOT sorted in any way, unless you add an ORDER BY, the fact that the result may look sorted to you is just accidental – RiggsFolly Nov 04 '22 at 10:39
-
You can read about default sorted columns from here https://stackoverflow.com/questions/8746519/sql-what-is-the-default-order-by-of-queries – Tural Rzaxanov Nov 04 '22 at 10:50
-
There no such thing as "default ordering" in a table. – Joe DiNottra Nov 04 '22 at 12:17
-
But in other tables, it's order by id always. This particular table sorts differently – Valerie Nov 04 '22 at 15:33