简体   繁体   中英

mysql alter table order by not working

I have searched over net a lot. What I could understand is that this thing has been faced by many people before me and it has also been filed as mysql bugs. But I couldn't find any solution to this. The problem is just that I can't get this command working-

alter table areas order by area_name;

I get this warning -

ORDER BY ignored as there is a user-defined clustered index in the table 'areas'

I just want to sort the table on the basis of ' area_name ', that is, names of areas. Just to add, I am trying to do this in the database of my laravel app .

If the db engine is InnoDB , then you can't do this.

From the doc:

ORDER BY does not make sense for InnoDB tables because InnoDB always orders table rows according to the clustered index.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM