时间:2021-07-01 10:21:17 帮助过:8人阅读
第一步:删除原有的外键约束
ALTER TABLE child_table DROP FOREIGN KEY `FK_Reference_2` ;
ALTER TABLE child_table ADD CONSTRAINT `FK_Reference_2` FOREIGN KEY (`parent_id` ) REFERENCES parent_table (`parent_id` ) ON DELETE CASCADE ON UPDATE RESTRICT;
mysql SQL设置外键约束ON DELETE CASCADE
标签: