1. Home
  2. Docs
  3. Chapter 14. Database Design & Engineering
  4. 2. Database Designer’s Guide
  5. Modeling database triggers in ERD

Modeling database triggers in ERD

Download PDF

A database trigger is a procedure that is automatically executed in response to certain events on a database table. A common use of database trigger is for auditing database. A trigger that records the insertion, modification and deletion of important data will let you know when and why certain change has been made to the database.

Creating a Trigger

  1. Select Triggers from diagram toolbar.
    Select Triggers
  2. Click on the ERD to create a triggers shape. Note again that this is a container of triggers, not the trigger itself.
  3. Enter its name.
    Triggers created
  4. To create a trigger, right click on the triggers shape and select New Trigger from the popup menu.
  5. Enter the physical name of the trigger.
    Trigger added
  6. Right click on the trigger and select Open Specification… from the popup menu.
  7. Enter the Create statement of trigger. The create statement entered here will be executed in database generation, so make sure it’s in correct syntax.
    Create statement of trigger

Moving or duplicating a trigger to another trigger container

  1. Select the trigger to move or duplicate.
    Select triggers to move or duplicate
  2. Drag over the target trigger container.
    Drag trigger towards the target triggers container
  3. If you want to duplicate the triggers, press on the Ctrl key and release the mouse button. If you want to move them from source to target trigger container, just release the mouse button.
    Triggers are moved