:: DEVELOPER ZONE
Table of Contents
Rudimentary support for triggers is included beginning with MySQL
5.0.2. A trigger is a named database object that is associated with a
table and that activates when a particular event occurs for the table.
For example, the following statements set up a table, as well as a
trigger for INSERT statements into the table. The
trigger sums the values inserted into one of the table's columns:
mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
-> FOR EACH ROW SET @sum = @sum + NEW.amount;
This chapter describes the syntax for creating and dropping triggers, and show some examples of how to use them.
Binary logging for triggers is done as described in Section 19.3, “Binary Logging of Stored Routines and Triggers”.
© 1995-2005 MySQL AB. All rights reserved.

User Comments
Warning: query failed: Unknown column 'user.firstname' in 'field list' in /data0/sites/live/web-main/lib/mysql-cxn.php on line 69
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data0/sites/live/web-main/lib/docbook.php on line 245
Add your own comment.