php myadmin中字段,PHP myAdmin -更改字段順序(上下移動)

How do I change the order of my table fields without deleting the field and re-inserting it, using PHP myAdmin?

如何在不刪除字段並使用myphp admin重新插入表字段的情況下更改表字段的順序?

8 个解决方案

#1

65

ALTER TABLE `table_name` MODIFY `column_you_want_to_move` DATATYPE AFTER `column`

DATATYPE is something like DATETIME or VARCHAR(20) ..etc

數據類型類似於DATETIME或VARCHAR(20) .等等

#2

22

Something like this will help

像這樣的東西會有幫助

ALTER TABLE Person MODIFY COLUMN last_name VARCHAR(50) AFTER first_name;

This will move last_name right after first_name in order.

這將按順序將last_name移到first_name之后。

#3

21

If you have phpMyAdmin 4.0.0+, you can use the phpMyAdmin Feature under Structure:

如果您有phpMyAdmin 4.0.0+,您可以在以下結構中使用phpMyAdmin特性:

aHR0cHM6Ly9pLmltZ3VyLmNvbS9BdDBQQ3lCLmpwZw==

#4

9

http://dev.mysql.com/doc/refman/5.0/en/change-column-order.html

From the Aforementioned Source:

If you decide to change the order of table columns anyway, you can do so as follows:

如果你決定改變表格列的順序,你可以這樣做:

Create a new table with the columns in the new order.

用新順序中的列創建一個新表。

Execute this statement:

執行這個語句:

mysql> INSERT INTO new_table -> SELECT columns-in-new-order FROM old_table;

將mysql>插入到new_table ->中,從old_table中選擇新訂單;

Drop or rename old_table.

或者重命名old_table下降。

Rename the new table to the original name:

將新表重命名為原始名稱:

mysql> ALTER TABLE new_table RENAME old_table;

mysql> ALTER TABLE new_table重命名old_table;

#5

8

Since version 4.0, phpMyAdmin has a "Move columns" dialog in Structure, that permits you to graphically move columns in the structure.

由於版本4.0,phpMyAdmin在結構上有一個“移動列”對話框,允許您在結構中以圖形方式移動列。

#6

3

alter table table_name modify column col_name type after col_name

#7

1

Another alternative:

另一個選擇:

CREATE new_table SELECT columns-in-new-order FROM old_table;

#8

1

if you have MySQL Workbench you can easily reorder columns using mouse, graphically.

如果你有MySQL工作台,你可以很容易地用鼠標重新排列列,圖形化。

Just connect to your database, select your table and after right click, alter table and then drag columns to reorder them.

只要連接到您的數據庫,選擇您的表,然后右鍵單擊,alter table,然后拖動列來重新排序它們。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值