What is TRIGGERS and how it can be used in MySQL?
In Mysql, a trigger is a database object that is directly associated with a table. It will be activated when a defined action is executed for the table. It can be performed when you run one of the following MySQL like INSERT, UPDATE and DELETE occurred in a table. It's activation time can be BEFORE or AFTER
Example
mysql> delimiter //
mysql> CREATE TRIGGER age_check BEFORE INSERT ON people FOR EACH ROW IF NEW.age < 0 THEN SET NEW.age = 0; END IF;
mysql> delimiter ;