lunix修改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];

猜你喜欢

转载自www.cnblogs.com/pywjh/p/9383257.html