Syntax for creating triggers using MySqlWorkbench
DELIMITER|
CREATE TRIGGER <触发器名> AFTER DELETE ON student
FOR EACH ROW BEGIN
DELETE FROM Grade WHERE stuId=old.stuId;
END;
|
DELIMITER;
The above is to create a trigger on the student table, when a record is deleted from the student table, the corresponding student information in the score table will be deleted