MySQL安排现有的表列 [英] MySQL arrange existing table columns
本文介绍了MySQL安排现有的表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改 MySQL 表中某个现有列的位置?
How can I change the position of a certain existing column in MySQL table?
Ex:我想将列 username 从其当前位置移到所有列之后,或者我希望它在表中的某些列之前.
Ex: I want to move the column username from its current position to instead be after all the columns or I want it before any certain column in my table.
推荐答案
您可以根据需要更改列的顺序.
You can change the order of columns if you like.
如果您的用户名列为varchar(255),则:
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?
这篇关于MySQL安排现有的表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文