问、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;
在第一节基础上 更新了函数和执行顺序:实操了字符数函数、时间函数、字段截取函数、interval函数等,除最后顺序实操因未导入数据库,导致无法执行