In Oracle Database, which statement best describes a view and how it relates to the underlying base tables?

Difficulty: Easy

Correct Answer: A view is a virtual table defined by a SELECT query that does not store data itself but retrieves data from underlying base tables

Explanation:


Introduction / Context:
This question tests the fundamental concept of views in Oracle and other relational databases. Views are extremely important for security, abstraction, and simplifying complex queries. Many interview questions on SQL begin with a basic definition of what a view is and then progress to more advanced features such as updatable views and materialized views. Understanding the virtual nature of a standard view is the first step.


Given Data / Assumptions:

    - We are considering standard Oracle views, not materialized views.
    - A view is defined using a CREATE VIEW statement that contains a SELECT query.
    - The question focuses on how a view stores or does not store data and how it relates to base tables.


Concept / Approach:
In Oracle, a normal view is known as a virtual table. It has a name and a column structure and can be queried with SELECT just like a table. However, the data is not stored in the view itself. Instead, when you query the view, Oracle executes the view definition query against the underlying base tables and returns the result set. The view is simply a stored query definition in the data dictionary.


Step-by-Step Solution:
Step 1: Recall that a view is created using CREATE VIEW view_name AS SELECT ... FROM base_table. Step 2: Remember that the view definition is stored in the data dictionary, but the rows returned by the view come from the base tables each time you run a query. Step 3: Read option A and note that it correctly states that a view is a virtual table defined by a SELECT query and that it does not store data itself. Step 4: Examine option B, which claims that a view is a physical copy with its own data. This is actually the behavior of a materialized view, not a normal view. Step 5: Recognize that option C confuses views with indexes, which are separate structures used only for performance. Step 6: Identify that option D describes backup or export files, which are not related to views.


Verification / Alternative check:
If you drop the base table of a normal view, the view becomes invalid, which proves that the data does not reside in the view itself. Also, querying USER_VIEWS in Oracle shows the text of the SELECT statement that defines the view, not stored rows. These observations confirm that a view is a stored query, not a separate physical data store.


Why Other Options Are Wrong:
Option B is wrong because it describes materialized views or table copies, not standard views. Option C incorrectly states that a view is a type of index, but indexes store key and rowid information and are designed only to speed up lookups. Option D talks about backup files such as export dumps, which are outside the relational schema. Only option A matches the standard definition of a view in Oracle.


Common Pitfalls:
A frequent mistake is to assume that views always improve performance. While they can simplify queries, they may actually make performance worse if the underlying SQL is complex. Another pitfall is forgetting that changes in base tables are immediately visible through the view, because no separate storage exists. Learners should also be careful to distinguish views from materialized views, which do store data on disk and require refresh operations.


Final Answer:
A view in Oracle is a virtual table defined by a SELECT query that does not store data itself but retrieves data from the underlying base tables at query time.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion