Change fields order in Mysql

Go To


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 - Kris.Mitchell 2012-04-04 18:57


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

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


Try this

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

2012-10-04 10:28
by Vineesh Kalarickal