How to change the foreign key referential action? (behavior)

后端 未结 6 558
眼角桃花
眼角桃花 2020-11-27 13:11

I have set up a table that contains a column with a foreign key, set to ON DELETE CASCADE (delete child when parent is deleted)

What would the SQL com

6条回答
  •  一整个雨季
    2020-11-27 13:37

    ALTER TABLE DROP FOREIGN KEY fk_name;
    ALTER TABLE ADD FOREIGN KEY fk_name(fk_cols)
                REFERENCES tbl_name(pk_names) ON DELETE RESTRICT;
    

提交回复
热议问题