Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
Triggers are special stored program units that execute automatically in response to specific database events. The precise attachment point matters: in most DBMSs, DML triggers are attached to a table or view, while some systems also support database- or server-level DDL/event triggers. The statement here is overly vague and misleading.
Given Data / Assumptions:
Concept / Approach:
The standard definition associates DML triggers with a specific table or view: they fire on INSERT, UPDATE, or DELETE to that object. Some systems also provide DDL triggers that fire on CREATE/ALTER/DROP events at the database or schema scope. Therefore, saying a trigger is “attached to a database” incorrectly suggests that is the normal attachment for all triggers, which is not the case.
Step-by-Step Solution:
Verification / Alternative check:
Check vendor docs: SQL Server distinguishes DML triggers (on tables/views) and DDL triggers (on DATABASE/ALL SERVER). PostgreSQL uses triggers on tables; event triggers exist for DDL at database level.
Why Other Options Are Wrong:
Common Pitfalls:
Defining triggers at the wrong scope; assuming a trigger can “watch everything” in a database by default; forgetting that triggers execute with transaction semantics tied to the firing statement.
Final Answer:
Incorrect
Discussion & Comments