BEFORE UPDATE Trigger
BEFORE UPDATE Trigger (BEFORE_UPDATE_TRIGGER) is a MySQL date/time helper. Dates are stored in DATE / DATETIME / TIMESTAMP columns. Always quote literals: '2026-08-19'.
Typical pattern: SELECT BEFORE_UPDATE_TRIGGER(…); or SELECT BEFORE_UPDATE_TRIGGER(dob) FROM students; NOW() / CURDATE() / CURTIME() have empty brackets — they read the clock.
DATE_FORMAT(dob, '%d-%b-%Y') is for display. DATEDIFF(end, start) is days between. INTERVAL 7 DAY is how you add a week: DATE_ADD(CURDATE(), INTERVAL 7 DAY).
Trap: comparing dates as VARCHAR. Trap: TIMESTAMP vs DATETIME timezone stories — DATETIME is ‘wall clock’, TIMESTAMP is UTC-stored (say this only if asked).
On the example next to this theory — BEFORE UPDATE Trigger — uPDATE changes existing rows — always scope with WHERE.
BEFORE_UPDATE_TRIGGER: one SELECT example. Quote 'YYYY-MM-DD'.