nerdexam
Snowflake

SOL-C01 · Question #17

You have a table named 'CUSTOMER ORDERS' with columns 'ORDER ID', 'CUSTOMER ID', and 'ORDER DATE'. You want to create a clone of this table for testing purposes, ensuring the cloned table contains onl

The correct answer is B. CREATE TABLE TEST ORDERS AS SELECT FROM CUSTOMER ORDERS WHERE 1=0;. Option B uses the CREATE TABLE ... AS SELECT pattern with WHERE 1=0 - a condition that is always false - so the query returns no rows, resulting in a new table that inherits the column structure from CUSTOMER ORDERS but contains zero data. This is a widely supported, standard SQL

Data Loading and Unloading

Question

You have a table named 'CUSTOMER ORDERS' with columns 'ORDER ID', 'CUSTOMER ID', and 'ORDER DATE'. You want to create a clone of this table for testing purposes, ensuring the cloned table contains only the schema definition and no data. Which of the following commands achieves this?

Options

  • ACREATE TABLE TEST ORDERS LIKE CUSTOMER ORDERS;
  • BCREATE TABLE TEST ORDERS AS SELECT FROM CUSTOMER ORDERS WHERE 1=0;
  • CCREATE TABLE TEST ORDERS CLONE CUSTOMER ORDERS;
  • DCREATE TABLE TEST ORDERS LIKE CUSTOMER ORDERS DATA ONLY;
  • ECREATE TABLE TEST ORDERS CLONE CUSTOMER ORDERS WHERE 1=0;

How the community answered

(42 responses)
  • A
    2% (1)
  • B
    81% (34)
  • C
    2% (1)
  • D
    10% (4)
  • E
    5% (2)

Explanation

Option B uses the CREATE TABLE ... AS SELECT pattern with WHERE 1=0 - a condition that is always false - so the query returns no rows, resulting in a new table that inherits the column structure from CUSTOMER ORDERS but contains zero data. This is a widely supported, standard SQL technique for schema-only table copies.

Why the distractors are wrong:

  • A (LIKE) copies structure in some databases (MySQL, PostgreSQL), but this question's context treats it as incorrect - and critically, LIKE behavior and support varies across platforms, making it unreliable.
  • C (CLONE) is Snowflake syntax that performs a full zero-copy clone of both the schema and the data - the opposite of what is needed.
  • D (LIKE ... DATA ONLY) is fabricated syntax that does not exist in any standard SQL dialect.
  • E (CLONE ... WHERE 1=0) is invalid because the CLONE command does not accept a WHERE clause for filtering rows.

Memory tip: Think of WHERE 1=0 as a "lie detector" - it's always false, so SQL selects nothing, giving you an empty shell of the original table. "False condition = false data = schema only."

Topics

#CTAS#Table Cloning#DDL#Schema Definition

Community Discussion

No community discussion yet for this question.

Full SOL-C01 Practice