Created
August 20, 2020 15:17
-
-
Save gbarreiro/44920f74efe06efa99fa5a7c99665602 to your computer and use it in GitHub Desktop.
MySQL cheatsheet: triggers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Triggered after a INSERT operation on "Students" table | |
CREATE TRIGGER my_trigger AFTER INSERT ON Students FOR EACH ROW | |
BEGIN | |
-- ... instructions to be performed ... -- | |
END; | |
-- Triggered before a DELETE operation on "Teachers" table | |
CREATE TRIGGER my_trigger BEFORE DELETE ON Teachers FOR EACH ROW | |
BEGIN | |
-- ... instructions to be performed ... -- | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment