Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**Architectural Logic**: Triggers automate on DML; use sparingly—hidden logic, cascading effects. **Types**: BEFORE/AFTER; FOR EACH ROW or STATEMENT. **Use Cases**: Audit logging; validation; derived columns. **Example**: `CREATE TRIGGER audit_insert AFTER INSERT ON orders FOR...
Architectural Logic: Triggers automate on DML; use sparingly—hidden logic, cascading effects. Types: BEFORE/AFTER; FOR EACH ROW or STATEMENT. Use Cases: Audit logging; validation; derived columns. Example: CREATE TRIGGER audit_insert AFTER INSERT ON orders FOR EACH ROW EXECUTE FUNCTION log_audit(). Caution: Bypass application logic; harder to debug; performance impact. Scalability: Row-level triggers add overhead per row. Best Practice: Use sparingly; prefer application logic; use for audit trails, referential integrity. In data warehouses, prefer ETL over triggers.
Red Flag: Complex business logic in triggers—maintainability nightmare. Pro-Move: Triggers for audit only; document all triggers; prefer app-layer logic; reference performance impact.
According to DataEngPrep.tech, this is one of the most frequently asked SQL interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.