[ACCEPTED]-PHP myAdmin - Change Field Order (Move Up Or Down)-phpmyadmin

Accepted answer
Score: 75
ALTER TABLE `table_name` MODIFY `column_you_want_to_move` DATATYPE AFTER `column`

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

0

Score: 40

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

Score: 24

Something like this will help

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

This will move 1 last_name right after first_name in order.

Score: 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 5 columns anyway, you can do so as follows:

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

  2. Execute this statement:

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

  3. Drop 2 or rename old_table.

  4. Rename the new table 1 to the original name:

    mysql> ALTER TABLE new_table RENAME old_table;

Score: 8

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

Score: 4
alter table table_name modify column col_name type after col_name

0

Score: 3

It's simple. Just go to PHPmyadmin, click 4 on your database, then click table. Then 3 click on structure. Below the table look 2 for the button, "Move columns". Click and 1 order the columns the way you want.

Score: 1

Another alternative:

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

0

Score: 1

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

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

More Related questions