mysql change the field ordering add and delete fields

1. Change the sort field

The username field moves behind id

alter table table_name modify `username` varchar(20) DEFAULT NULL COMMENT '用户名' after `id`  

2. Delete the field

alter table table_name drop `username`

3. Add fields (fields added after the specified field)

alter table table_name add `name` varchar(80) COMMENT '名字' after `user_status`

4. Edit field name (from Type to type)

alter table table_name change  `Type` `type` int(8) DEFAULT NULL COMMENT '类型'

Ah, the first record to be here, and then later use the new content update

Guess you like

Origin blog.csdn.net/luo_yu_1106/article/details/90447835