Terminology check: a program stored inside the database that performs a common action on data is called a(n) ________.
-
Atrigger
-
Bstored procedure
-
Cpseudofile
-
DNone of the above is correct
Answer
Correct Answer: stored procedure
Explanation
Introduction / Context:Databases support server-side code for performance, security, and reuse. Two common programmable objects are triggers and stored procedures. They differ by how they are invoked.
Given Data / Assumptions:
- We want the generic program that can be invoked deliberately (for example, EXEC or CALL) to perform actions.
- The code resides in the database and can contain SQL and procedural logic.
Concept / Approach:A stored procedure is a named program stored in the database, executed by clients or other procedures. A trigger is also stored but fires automatically in response to DML/DDL events; it is not invoked directly by users in normal operation.
Step-by-Step Solution:
Match “program that performs some common action and is stored in the database” with “stored procedure.”Differentiate from triggers (event-driven).Eliminate distractors (pseudofile / none).Verification / Alternative check:Examples: PostgreSQL functions, SQL Server stored procedures, Oracle procedures/packages.
Why Other Options Are Wrong:
- Trigger: event-driven code, not ad hoc invoked.
- Pseudofile: not a DBMS programmable object.
- None: incorrect because “stored procedure” fits.
Common Pitfalls:Assuming triggers are interchangeable with procedures; triggers are tied to table/view events and execute implicitly.
Final Answer:stored procedure