dreamhappy2012

2019-07-19   阅读量: 756

Mysql

MySQL怎么删除外键约束?

扫码加入数据分析学习群

问、MySQL怎么删除外键约束

答:

语法:alter table +表名+drop foreign key+外键名

–例:删除数据表 tb_emp2 中的外键约束

create table tb_emp2

(id int(11) primary key,

name varchar(25),

deptid int(11),

salary float,

constraint hehe foreign key(deptid) references tb_dept(id));

alter table tb_emp2 drop foreign key hehe;

150.0681 2 6 关注作者 收藏

评论(0)


暂无数据

推荐课程