Difficulty: Easy
Correct Answer: ALTER VIEW
Explanation:
Introduction / Context:
Views depend on underlying tables and other objects. When dependencies change, some DBMSs require recompilation to validate the view definition and refresh its execution metadata. Identifying the correct statement for recompiling an existing view is a common administrative skill.
Given Data / Assumptions:
Concept / Approach:
The correct approach is to alter an existing object. In many platforms, the statement is ALTER VIEW (for example, ALTER VIEW view_name COMPILE in Oracle, or ALTER VIEW view_name AS … in SQL Server to refresh the definition). “CREATE VIEW” defines a new view; “COMPILE VIEW” and “DEFINE VIEW” are not standard SQL statements.
Step-by-Step Solution:
Confirm object state: the view already exists.Choose the SQL verb for modifying existing objects: ALTER.Apply to the object type VIEW: ALTER VIEW … (possibly with COMPILE in dialects that support it).
Verification / Alternative check:
DBMS documentation shows that view maintenance tasks use ALTER VIEW for recompilation/refresh. In information_schema-based systems, you may need to reissue the view definition via ALTER VIEW to update metadata after schema changes.
Why Other Options Are Wrong:
Common Pitfalls:
Dropping and recreating a view unnecessarily (which can cascade permissions), or assuming a simple SELECT from the view forces recompilation—some systems cache plans that require explicit alter/refresh.
Final Answer:
ALTER VIEW
Discussion & Comments