PrepZone Logo
PrepZone
Back to Database

Database · Medium

What are database triggers? When should you use them vs application logic?

DatabaseFundamentalsFresher

Answer preview

A trigger is procedural code the database executes automatically when a specified event — INSERT, UPDATE, DELETE, or a DDL/logon event — occurs on a table. It runs inside the same transaction as the triggering statement, so if the trigger fails, the whole statement rolls back.…