13.4. SQL: Triggers

Triggersprovide yet another way to change table populations. Although not included in the standard until SQL: 1999, triggers have been used by commercial dialects for many years. As well as enforcing constraints, triggers may be used to perform other actions, including computation of derived columns, maintaining audit or summary data in other tables, and initiating external actions such as sending email.

A trigger specifies a set of SQL statements that will be executed automatically when a given event takes place on a table (or, in some circumstances that we’ll discuss shortly, a view). The event causing the execution of the trigger can be an attempt to insertnew rows, deleteexisting rows, or updateexisting rows in the table. ...

Get Information Modeling and Relational Databases, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.