MySql Triggers: How to
MySql 5.0 come up with many great features. One most important feature is trigger. Triggere support is in initial phase but, will be extended in future release. here I am going to present a brief easy to understand tutorial for mysql triggers.
Triggers are MySql statements, commends which are executed on a definded event. These events may be (INSERT, UPDATE, DELETE). So at the top level we can categorize triggers in 3 categories
1. Create
2. Update
3. Delete
The basic syntax of trigger definition is
CREATE
[DEFINER = { user | CURRENT_USER }]
TRIGGER trigger_name trigger_time trigger_event
ON tbl_name FOR EACH ROW trigger_stmt
DEFINER The author of this trigger. This must be mysql user.
trigger_name The name of trigger.
trigger_event Event to trigger
trigger_stmt Action to be applied
This was very basic introduction of triggers. In my following posts I will post some real world example of triggers.










(121 votes, average: 4.00 out of 5)