MySQL arrange existing table columns

前端 未结 6 527
鱼传尺愫
鱼传尺愫 2021-01-30 03:35

How can I change the position of a certain existing column in MySQL table?

Ex: I want to move the column username from its current position to

6条回答
  •  梦如初夏
    2021-01-30 04:35

    You can change the order of columns if you like.

    If your username column is varchar(255) then:

    alter table `mytable` 
    change column username username varchar(255) after `somecolumn`;
    

    If it helps to better read a table definition, then why not?

提交回复
热议问题