are small procedural programs – stored routines – written in SQL,
that are run automatically when specified
(such as rows being added,
deleted or updated) occur on a particular table.
Triggers can be used:
to perform stronger, or more complex and adaptive, integrity checks than
are possible with the inbuilt mechanisms,
to automatically perform routine operations, such as logging, tallying, or
notification that should occur as a consequence of the original operation,
to add additional functionality and/or overcome some of the limitations
in any particular implementation of SQL.
There is a
between the SQL standard and particular
implementations, such as MySQL.
Jianxin Li (UWA)
2 / 38