Saya belum mengujinya, tetapi berdasarkan dokumentasi , ini terlihat benar:
CREATE TRIGGER update_user_before_delete BEFORE DELETE ON department
FOR EACH ROW BEGIN
UPDATE user SET department = 1 WHERE department = OLD.department;
END;
Saya belum mengujinya, tetapi berdasarkan dokumentasi , ini terlihat benar:
CREATE TRIGGER update_user_before_delete BEFORE DELETE ON department
FOR EACH ROW BEGIN
UPDATE user SET department = 1 WHERE department = OLD.department;
END;