DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) Triggers

Info Catalog (mysql.info.gz) Stored Procedures (mysql.info.gz) Top (mysql.info.gz) INFORMATION_SCHEMA
 
 20 Triggers
 ***********
 
 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.
 

Menu

 
* CREATE TRIGGER              `CREATE TRIGGER' Syntax
* DROP TRIGGER                `DROP TRIGGER' Syntax
* Using triggers              Using Triggers
 
Info Catalog (mysql.info.gz) Stored Procedures (mysql.info.gz) Top (mysql.info.gz) INFORMATION_SCHEMA
automatically generated byinfo2html