Database Trigger

Noun · Development

Definitions

  1. A database function that executes automatically in response to INSERT, UPDATE, or DELETE events on a table. Can fire BEFORE (to validate/modify) or AFTER (to audit/cascade) the operation. Powerful for maintaining derived data, audit logs, and enforcing complex constraints. Overuse creates hard-to-debug 'invisible' business logic.

    In plain English: Automatic code that runs in the database whenever data is inserted, updated, or deleted — useful for audit logs but dangerous if overused.

    Example: "The audit trigger captures every change to the accounts table — who changed what, when, with old and new values. Business logic should NOT go in triggers."

Related Terms