Understanding Triggers
A trigger is a stored database object that contains a series of SQL commands, set to activate automatically when certain events take place.
Each trigger is associated with a table. You can create a trigger that will fire when an INSERT, UPDATE, or DELETE takes place on the named table.
REPLACE
Remember that when you use a REPLACE statement, MariaDB actually performs a DELETE followed by an INSERT. Therefore, the REPLACE command will activate a DELETE trigger if the row already exists and will always activate an INSERT TRigger.