A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view.
MySQL trigger syntax
In order to create a new trigger, you use the statement
CREATE TRIGGER. The following illustrates the syntax of the
CREATE TRIGGER statement:
Let’s examine the syntax above in more detail.