PHP myAdmin - Change Field Order (Move Up Or Down)

后端 未结 9 1106
伪装坚强ぢ
伪装坚强ぢ 2020-12-23 16:23

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

9条回答
  •  春和景丽
    2020-12-23 16:56

    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:

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

    2. Execute this statement:

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

    3. Drop or rename old_table.

    4. Rename the new table to the original name:

      mysql> ALTER TABLE new_table RENAME old_table;

提交回复
热议问题