Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
SQL is used in multiple contexts: inside database-resident program units (procedures, functions, triggers) and in external application code via APIs such as JDBC, ODBC, ADO.NET, or embedded SQL preprocessors. This question verifies that you recognize these locations as valid places for SQL.
Given Data / Assumptions:
Concept / Approach:
Triggers and stored procedures are server-side constructs that execute in the DBMS process and can contain DML (SELECT/INSERT/UPDATE/DELETE) and often DDL (with permissions). Application code can issue SQL through parameterized commands, prepared statements, or ORM-generated SQL.
Step-by-Step Solution:
Verification / Alternative check:
Review vendor docs: PL/SQL (Oracle), T-SQL (SQL Server), PL/pgSQL (PostgreSQL) all allow embedded SQL; Java/Python/C# samples show SQL execution from code.
Why Other Options Are Wrong:
Common Pitfalls:
Believing that SQL belongs solely in applications and not in the database; overlooking governance benefits of procedures/triggers (centralized logic, permissions).
Final Answer:
Correct
Discussion & Comments