简体   繁体   中英

Move column_name AFTER Column_name using MySQL

I need to move a column_name AFTER column_name;

I have done the following:

ALTER TABLE tables_name MODIFY COLUMN columns_name AFTER columns_name;

Any suggestions,

This should do it for you:

ALTER TABLE `schema`.`table`   
  CHANGE `column_name` `column_name` INT(11) NULL  AFTER `other_column`;

They key here is CHANGE instead of MODIFY like you have.

I also did this,

ALTER TABLE doughnuts MODIFY COLUMN column_name INT AFTER column_name;

I am getting a error under the INT, but the query stills runs and works properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM