Introduction
BEFORE INSERT triggers let you run some checks or changes right before new data is added to a table. This helps keep data clean and correct automatically.
You want to check or change data before it is saved, like making sure a username is lowercase.
You want to add a timestamp or default value automatically before saving a new row.
You want to prevent bad or duplicate data from being inserted.
You want to log or audit data before it is stored.
You want to modify data fields based on some rules before saving.