[ACCEPTED]-PHP myAdmin - Change Field Order (Move Up Or Down)-phpmyadmin
ALTER TABLE `table_name` MODIFY `column_you_want_to_move` DATATYPE AFTER `column`
DATATYPE is something like DATETIME or VARCHAR(20) ..etc
0
If you have phpMyAdmin 4.0.0+, you can use 1 the phpMyAdmin Feature under Structure:
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.
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:
Create 4 a new table with the columns in the new 3 order.
Execute this statement:
mysql>
INSERT INTO new_table -> SELECT columns-in-new-order FROM old_table;
Drop 2 or rename old_table.
Rename the new table 1 to the original name:
mysql>
ALTER TABLE new_table RENAME old_table;
Since version 4.0, phpMyAdmin has a "Move 2 columns" dialog in Structure, that permits 1 you to graphically move columns in the structure.
alter table table_name modify column col_name type after col_name
0
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.
Another alternative:
CREATE new_table SELECT columns-in-new-order FROM old_table;
0
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
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.