简体   繁体   English

根据phpmyadmin中的“主键”和“ auto_increment”列对行进行排序

[英]Sort rows according to “primary key” and “auto_increment” column in phpmyadmin

I want that phpmyadmin returned ascended sorted rows, according to column, with has primary key and auto_increment (for example id ). 我希望phpmyadmin根据列返回具有primary keyauto_increment (例如id )的升序排序行。

somethimes My phpmyadmin returns disordered rows. somethimes我的phpmyadmin返回无序的行。 there is some option for sorting rows? 有一些对行进行排序的选项吗? This is just more readable. 这只是更具可读性。

By default, phpMyAdmin does not perform any kind of sort, and just shows the rows as they are stored in the database. 默认情况下,phpMyAdmin不执行任何类型的排序,仅显示存储在数据库中的行。 Sometimes rows get inserted "out of order", but you can fix this: 有时,行会“无序地”插入,但是您可以解决此问题:

  • navigate to the table in question 导航到相关表格
  • click 'operations' 点击“操作”
  • at the top left, under "Alter table order by", select your key and your order, and click 'go' 在左上角的“更改表格排序依据”下,选择您的密钥和订单,然后点击“开始”

This is an ongoing maintenance thing that you will need to do from time to time, but it should solve your issue for the most part. 这是您需要不时进行的一项持续维护工作,但是它应该可以在很大程度上解决您的问题。

In phpMyAdmin 4.5.0, maybe in earlier versions too, you can set the $cfg['TablePrimaryKeyOrder'] config like so: 在phpMyAdmin 4.5.0中,也许在早期版本中,也可以这样设置$ cfg ['TablePrimaryKeyOrder']配置:

$cfg['TablePrimaryKeyOrder'] = 'DESC'

This defines the default sort order for the tables, having a primary key, when there is no sort order defines externally. 当没有外部定义的排序顺序时,这定义了具有主键的表的默认排序顺序。 Acceptable values : ['NONE', 'ASC', 'DESC'] 可接受的值:['NONE','ASC','DESC']

This sets the default sort if the table has a primary key and that no other sort has been applied to it. 如果表具有主键并且尚未对其应用其他排序,则此设置为默认排序。

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

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