MySQL sort by a column by default in phpMyAdmin

后端 未结 2 643
慢半拍i
慢半拍i 2021-01-20 05:17

I added a new index in my table and now phpMyAdmin is sorting the rows by that column by default. How do I make phpMyAdmin sort the rows by the id column instea

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-20 05:45

    There is no "default" ordering of rows. If you want a query to return rows in a particular order, then you must use an order by clause.

    You cannot even depend on rows being returned by the primary key order. In fact, with updates/deletes/inserts on the table, this will often not be true.

    If you want a query to return rows in a particular order, then you must use an order by clause (I realize I repeated that). The only exception is that MySQL (in violation of the standard) guarantees the ordering of results when using group by.

提交回复
热议问题