linux修改mysql表结构

增加字段:

1 alter table [tablename] add [字段名] [字段类型] first(首位);
2 
3 alter table [tablename] add [字段名] [字段类型] after [其他已有字段](后面);

删除字段:

1 alter table [tablename] drop [字段名]

修改字段:(改变)

1 alter table [tablename] change [已有字段名] [新字段名] [字段类型];

修改字段类型:(修改)

1 alter table [tablename] modify [已有字段名] [字段类型]

修改表名:

1 alter table [tablename] rename [new_tablename];

 

posted @ 2018-07-28 20:07  pywjh  阅读(1133)  评论(0编辑  收藏  举报
回到顶部