COF-C02 · Question #309
A permanent table and temporary table have the same name, TBL1, in a schema. What will happen if a user executes select * from TBL1 ;?
The correct answer is A. The temporary table will take precedence over the permanent table. In Snowflake, temporary tables are session-scoped and take name precedence over permanent tables within the same session. If a temporary table (TBL1) and a permanent table (TBL1) share the same name in the same schema, any query referencing TBL1 in that session will resolve to…
Question
A permanent table and temporary table have the same name, TBL1, in a schema. What will happen if a user executes select * from TBL1 ;?
Options
- AThe temporary table will take precedence over the permanent table.
- BThe permanent table will take precedence over the temporary table.
- CAn error will say there cannot be two tables with the same name in a schema.
- DThe table that was created most recently will take precedence over the older table.
How the community answered
(47 responses)- A91% (43)
- B2% (1)
- C2% (1)
- D4% (2)
Explanation
In Snowflake, temporary tables are session-scoped and take name precedence over permanent tables within the same session. If a temporary table (TBL1) and a permanent table (TBL1) share the same name in the same schema, any query referencing TBL1 in that session will resolve to the temporary table. This is by design - Snowflake resolves name conflicts in this priority order: temporary > transient > permanent. No error is thrown. Once the session ends and the temporary table is dropped, queries will again resolve to the permanent table.
Topics
Community Discussion
No community discussion yet for this question.