Change fields order in Mysql

Go To StackoverFlow.com

0

Is it possible to change the order of fields in mysql (using phpmyadmin xampp) by which they appear without dropping the current table.

2012-04-04 18:55
by manoj
Dup: I think http://stackoverflow.com/questions/1962448/php-myadmin-change-field-order-move-up-or-dow - Kris.Mitchell 2012-04-04 18:57


4

I'm not sure about phpmyadmin, but you can certainly do that with an SQL query:

ALTER TABLE `table`
CHANGE COLUMN `oldname` `newname` *column_definition* [AFTER|BEFORE] `colname`;
2012-04-04 18:58
by abresas
...and you can use phpmyadmin to run that query so the answer would be yes - d_inevitable 2012-04-04 18:59
good point @d_inevitable, i'll delete my answe - joelparkerhenderson 2012-04-04 19:00
Hi, this showed errors on running the sql query ALTER TABLE 'teachers-final' CHANGE COLUMN 'Field' 'Fields' varchar(20) [AFTER] 'Name'; Any Suggestions - manoj 2012-04-05 02:30
simply AFTER. remove bracket - abresas 2012-04-05 21:50


3

Try this

ALTER TABLE table_name MODIFY COLUMN column_name1 varchar(100) AFTER column_name2

2012-10-04 10:28
by Vineesh Kalarickal
Ads