1.添加主键

alter table 表名 add primary key(字段名称)

alter table user3 add primary key(id);

2.删除主键

alter table 表名 drop primary key;

alter table user3 drop primary key;

3.【财务总监点评】:

当有 auto_increment属性时,不能直接删除primary key。

正确的操作是:先将主键的auto_increment属性去掉

感谢观看