Changing default sorting behavior of mysql

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

I have a table in my database.

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


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-20 19:55

    select * from students order by rollno asc; will return your results sorted by that column. It should be noted that there is no default sorting behavior as far as data is actually stored in the database (aside from identities and indexes); you should never depend on your results being sorted a certain way unless you explicitly sort them (using order by).

提交回复
热议问题