MYSQL添加约束,删除约束 添加列,修改列,删除列
添加主键约束:
alter table 表名 add constraint 主键 (形如:PK_表名) primary key 表名(主键字段);
添加外键约束:
alter table 从表 add constraint 外键(形如:FK_从表_主表) foreign key 从表(外键字段) references 主表(主键字段);
删除主键约束:
alter table 表名 drop primary key;
删除外键约束:
alter table 表名 drop foreign key 外键(区分大小写);
添加列:
alter table 表名 add column 列名 varchar(30);
删除列:
alter table 表名 drop column 列名;
修改列名MySQL:
alter table bbb change nnnnn hh int;
修改列属性:
alter table t_book modify name varchar(22);
bitsCN.comCopyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务