批改主键和外键

修改主键和外键?--删除主键并添加新主键 alter table 表名 drop column 主键名 alter table 表名add 主键

修改主键和外键

?

--删除主键并添加新主键 alter table 表名 drop column 主键名; alter table 表名     add 主键列名 int not null primary key auto_increment;--删除约束alter table 表名 drop constraint 约束名--添加主键约束alter table 表名   add constraint 约束名 primary key(列名);--添加外键约束alter table 表名  add constraint 约束名 foreign key(外键名) references 参照表(列名)  --修改列定义alter table 表名modify 列名 int not null;--删除列alter table 表名 drop column 列名;--修改表名ALTER   TABLE   table   RENAME   TO   新表名