How to move a column in MySQL

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;

This entry was posted in MySQL. Bookmark the permalink.

One Response to How to move a column in MySQL

  1. Tom Buchok says:

    Thanks a lot for this. Exactly what I needed.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>