1.

What is TRIGGERS and how it can be used in MySQL?

Answer»

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 ;



Discussion

No Comment Found