原文来自:http://hi.baidu.com/hipanchun/item/e6f130dafc51daf9cb0c39dc
1、创建表格时添加: create table tablename(id int auto_increment primary key,...)
2、创建表格后添加: alter table tablename add id int auto_increment primary key
3、设置主键:alter table tablename add primary key(field_name);
4、重命名表: alter table table_old_name rename table_new_name;
5、改变字段的类型:alter table tableName modify field_name field_type;
6、重命名字段:alter table tableName change old_field_name new_field_name new_field_type;
7、删除字段:alter table tableName drop column field_name;
8、增加一个新字段:alter table tableName add new_field_name field_type;
alter table tableName add new_field_name field_type not null default '0';
9、新增一个字段,默认值为0,非空,自动增长,主键:alter table tabelname add new_field_name field_type default 0 not null auto_increment ,add primary key (new_field_name);