0
我有兩張表作爲學生和證書,我需要從學生表中刪除學生時從證書表中刪除與特定學生相關的證書。我不太熟悉mysql觸發器。請協助我。mysql觸發刪除原始
這是我做過嘗試,但我不知道這是正確的
DELIMITER $$
CREATE TRIGGER delCerts AFTER DELETE ON students
FOR EACH ROW
BEGIN
DELETE FROM certificates as certs WHERE certs.stCode = students.stCode;
END;
$$
取代「AFTER DELETE」,寫下「BEFORE DELETE」,讓我們知道 –