Move a column after some other column
mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT AFTER someothercolumn;
Move a column to the first position
mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT FIRST;
Move a column after some other column
mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT AFTER someothercolumn;
Move a column to the first position
mysql> ALTER TABLE mytable MODIFY COLUMN mycolumn INT FIRST;
Thanks a lot for this. Exactly what I needed.
Thanks!
Thanks!
So basically, if your column is of a type other than INT, you’ll need to remake it the way it was AFTER you move it. For ENUMs, copy-paste
Actually it could be done in the same query. For example:
ALTER TABLE mytable MODIFY COLUMN mycolumn VARCHAR(1000) AFTER someothercolumn;
If you have data in the column you intend to move (varchar for example) you (may) lose it completely when moving and changing to INT.
Thanks Masao
More accurately stated…
Move a column after some other column
Move a column to the first position
ALTER TABLE Syntax
Thanks very much bro!
THANK U MASAO…………..