以表名是appList为例,可以修改已生成表的以下属性。
1、修改表名
mysql> alter table appList rename appList1;
将表名appList改为appList1。
2、增加primary key
mysql> alter table appList add primary key(id)
将列id增加为primary key。
3、增加unique key
mysql> alter table appList add unique key(name);
将name增加为unique key。
4、删除unique key
mysql> alter table appList drop index name;
将name的unique key约束删除。
4、增加某列的默认值
mysql> alter table appList alter column count set default 0;
将列count的默认值设为0。