简体   繁体   English

MySQL不工作改变表顺序

[英]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. 我能理解的是,在我之前,很多人都面对过这个问题,并且它也已经作为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. 我只想基于“ area_name ”对表进行排序,即区域名称。 Just to add, I am trying to do this in the database of my laravel app . 只需添加一下,我正在laravel app的数据库中尝试执行此laravel app

If the db engine is InnoDB , then you can't do this. 如果数据库引擎是InnoDB ,那么您将无法执行此操作。

From the doc: 从文档:

ORDER BY does not make sense for InnoDB tables because InnoDB always orders table rows according to the clustered index. ORDER BY对InnoDB表没有意义,因为InnoDB始终根据聚集索引对表行进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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