How to rearrange MySQL columns?
The only way I know is to change the column. You would first extract your column definition using SHOW CREATE TABLE
and issue an ALTER TABLE
:
ALTER TABLE foo
CHANGE COLUMN bar
bar COLUMN_DEFINITION_HERE
FIRST;
Or if you want it after a certain other column:
... AFTER OTHER_COLUMN;
Modify also works. Have a look:
ALTER TABLE foo MODIFY bar bartype AFTER baz;