Changing default sorting behavior of mysql

后端 未结 3 2058
天命终不由人
天命终不由人 2021-01-20 19:18

I have a table in my database.

+--------+-------------+------+-----+---------+----------------+
| Field  | Type        | Null | Key | Default | Extra                 


        
3条回答
  •  梦毁少年i
    2021-01-20 19:58

    There is no default sort order!

    The DB returns the data in the fastest way possible. If this happen to be the order in which it is stored or a key is defined then this is up to the system. You can't rely on that.

    Think about it: Why would the DB use performace to order something by default if you don't need it ordered. DBs are optimised for speed.

    If you want it being ordered then you have to specify that in an order by clause.

提交回复
热议问题