May 2020
Beginner
564 pages
14h 9m
English
You can create multiple triggers on a table and have them precede or follow one another by adding the PRECEDES or FOLLOWS keywords to the trigger definition. The following code sample shows you the placement of these keywords:
CREATE TRIGGER triggername {BEFORE | AFTER} {INSERT | UPDATE| DELETE } ON tablename FOR EACH ROW {FOLLOWS | PRECEDES} anothertriggernametriggerbody;
You can add an additional trigger for BEFORE UPDATE to the allstarfull_copy table with the following code:
USE lahmansbaseballdb; CREATE TRIGGER before_allstar_update2 BEFORE UPDATE ON allstarfull_copy FOR EACH ROW FOLLOWS before_allstar_update INSERT INTO allstarfull_audit SET actiontype = 'update', playerid = OLD.playerid, ...
Read now
Unlock full access