Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
This question tests your understanding of SQL view updatability, particularly when a view includes a computed (derived) column such as a concatenation, arithmetic expression, or CASE expression. While views are powerful for abstraction and security, not all views are inherently updatable, and derived columns introduce special constraints that frequently block direct updates.
Given Data / Assumptions:
Concept / Approach:
A view is updatable only if the DBMS can map INSERT/UPDATE/DELETE on the view unambiguously to corresponding operations on the underlying base table rows and columns. Computed columns do not exist as stored attributes; they are generated from other columns at query time. Therefore, attempting to update a computed value is either meaningless or ambiguous unless the DBMS has rules to reverse the computation or a trigger that translates the update to base columns.
Step-by-Step Solution:
Verification / Alternative check:
Some DBMSs allow updates to non-computed columns of the view provided the rest of the updatability rules are met (key preservation, no aggregates, no DISTINCT, etc.). But the computed column itself remains non-updatable unless handled by triggers/rules.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming that because a column displays in a view it can be updated; forgetting key-preserved table rules; confusing computed columns with persisted generated columns (which still are not directly user-writable in many systems).
Final Answer:
Incorrect
Discussion & Comments