intermediateAdvanced SQL — Stored Procedures, Functions, Triggers & Sequences
What's the practical difference between a BEFORE trigger and an AFTER trigger?
A BEFORE trigger runs before the write happens and its return value actually replaces the row that gets written (or NULL cancels the write entirely) — it can inspect and modify the row. An AFTER trigger runs once the write has already happened, typically for side effects like audit logging, and its return value is ignored since the write can no longer be changed.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
What's the practical difference between a BEFORE trigger and an AFTER trigger?