mysql
As mentioned, how to first determine whether the foreign key exists and then delete it, like
if EXISTS((SELECT COUNT(*) FROM information_schema
.KEY_COLUMN_USAGE
where constraint_name='fk_emp_dept_id') > 0)
alter table org_employee
drop foreign key fk_emp_dept_id
;
Also,
if EXISTS((SELECT COUNT(*) FROM information_schema
.KEY_COLUMN_USAGE
where constraint_name='fk_emp_dept_id') > 0)
BEGIN
alter table org_employee
drop foreign key fk_emp_dept_id
;
END
will report an error, please give me an answer
https://zhidao.baidu.com/question/692089969116125764.html