COF-C02 · Question #288
A view is defined on a permanent table. A temporary table with the same name is created in the same schema as the referenced table. What will the query from the view return?
The correct answer is A. The data from the permanent table. The view will return data from the permanent table (A). In Snowflake, views store references to objects by their internal object ID, not just by name. The view was compiled and bound to the permanent table's ID at creation time. Temporary tables, even when they shadow a…
Question
A view is defined on a permanent table. A temporary table with the same name is created in the same schema as the referenced table. What will the query from the view return?
Options
- AThe data from the permanent table.
- BThe data from the temporary table.
- CAn error stating that the view could not be compiled.
- DAn error stating that the referenced object could not be uniquely identified.
How the community answered
(27 responses)- A85% (23)
- B4% (1)
- C4% (1)
- D7% (2)
Explanation
The view will return data from the permanent table (A). In Snowflake, views store references to objects by their internal object ID, not just by name. The view was compiled and bound to the permanent table's ID at creation time. Temporary tables, even when they shadow a permanent table name for direct queries in the session, do not affect how a pre-existing view resolves its referenced object. The view continues to read from the original permanent table.
Topics
Community Discussion
No community discussion yet for this question.