Definition of a SQL view — evaluate the statement: “A SQL view is a virtual table constructed from other tables or views.” Choose the best evaluation.
-
ACorrect
-
BIncorrect
-
CCorrect only if the view is updatable
-
DIncorrect unless the view is materialized
-
EIndeterminate without an execution plan
Answer
Correct Answer: Correct
Explanation
Introduction / Context: Views are pervasive in database development, used for security, abstraction, and reuse. This question asks whether a view can be described as a virtual table built from other tables or views. It checks your grasp of the conceptual model rather than performance specifics.
Given Data / Assumptions:
- We discuss standard virtual views created with CREATE VIEW AS SELECT ...
- Materialized or indexed views are a separate optimization feature in some systems.
- The phrase “constructed from other tables or views” refers to the underlying SELECT query.
Concept / Approach: A view presents the result of a stored query as if it were a table. The engine evaluates the view definition (often by query rewrite) against base tables or even other views. Thus, describing a view as a “virtual table constructed from other tables or views” is accurate. Whether it is updatable or materialized does not change that fundamental definition; those are properties or implementations layered on top.
Step-by-Step Solution:
Identify view creation: CREATE VIEW v AS SELECT ... FROM base1 JOIN base2 ...Interpret “virtual table”: projection of a query’s columns exposed as table-like schema.Conclude: statement correctly characterizes what a view is.Note: materialization is optional and vendor-dependent.Verification / Alternative check: Querying a view with SELECT * FROM v behaves like querying a table; dropping referenced tables invalidates the view, showing its dependence on other objects.
Why Other Options Are Wrong:
- Updatability and materialization are orthogonal to being a view.
- Execution plans vary but do not redefine what a view is.
Common Pitfalls: Believing views always store data; conflating materialized views with standard views; assuming views must be updatable.
Final Answer: Correct