thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Intermediate

Trigger

Procedural code that runs automatically in response to INSERT, UPDATE or DELETE events (or DDL events) on a table.

Definition

Triggers can fire BEFORE, AFTER or INSTEAD OF the event, at row or statement level. They are used for auditing, enforcing complex rules and maintaining derived data, but hidden logic can hurt performance and complicate debugging.

Example

An AFTER UPDATE trigger writes old and new salary values to an audit table.

Exam tip

TRUNCATE does not fire DELETE triggers; that difference is frequently tested.

Related terms