|
|
Trigger in MySQL - Mysql
|
Views : 220
|
|
Tagged in : Mysql
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Trigger in MySQL
A trigger is a set of code which is executed in response to some event.
E.g Update employee_perfomance table when a new task is inserted in task table. Here, the trigger is “update” and the event is “inserting a new row”.
A trigger in MySQL is created using CREATE TRIGGER trigger_name. we need to specify the trigger type.
* When do you want the trigger to execute? This can be either BEFORE or AFTER What do you expect the trigger to do? This can be INSERT UPDATE DELETE
* On which table you want the trigger to run? (using ON table_name)
* Lastly, though not mandatory, is FOR EACH ROW if it is used then the trigger will fire once for all records of the table. If it is not specified the trigger will fire once only regardless of the number of records being updated |
|
By Geethalakshmi, On - 2010-09-29 |
|
|
|