HomeInterview QuestionsHow can I check whether a table exists in Snowflak…

How can I check whether a table exists in Snowflake?

🟢 Easy Conceptual Junior level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

In Snowflake you can verify the existence of a table by querying the INFORMATION_SCHEMA or using the SHOW command. A common approach is:

sql
SELECT COUNT(*) AS tbl_cnt
FROM   INFORMATION_SCHEMA.TABLES
WHERE  TABLE_SCHEMA = 'MYSCHEMA'
  AND TABLE_NAME   = 'MYTABLE';

If tbl_cnt is greater than 0, the table exists. You can also use SHOW TABLES LIKE 'MYTABLE' and check the result set. For programmatic checks, wrap the query in a TRY/CATCH block or use CREATE TABLE IF NOT EXISTS to avoid errors. The operation is O(1) in terms of query complexity, as it only scans metadata tables. This method works for both permanent and transient tables and is the recommended way to perform existence checks in Snowflake.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500