1.5 Describe Snowflake objects and how they fit into the Snowflake hierarchy.
1.A developer needs to create a new development schema, `DEV_V2`, which should be an exact, point-in-time copy of the `PROD` schema as it existed at 8:00 AM yesterday. This includes all tables, views, and data within the schema at that time. Which SQL command will accomplish this most efficiently?
- A.`CREATE SCHEMA DEV_V2 COPY OF PROD AT(TIMESTAMP => '... 08:00:00');`
- B.`CREATE SCHEMA DEV_V2 CLONE PROD;`
- C.`CREATE OR REPLACE SCHEMA DEV_V2 FROM PROD;`
- D.`CREATE SCHEMA DEV_V2 CLONE PROD AT(TIMESTAMP => '... 08:00:00');`
Show answer & explanation
Correct answer: D — `CREATE SCHEMA DEV_V2 CLONE PROD AT(TIMESTAMP => '... 08:00:00');`
- A. Incorrect. The `COPY OF` syntax is not a valid clause for the `CREATE SCHEMA` command in Snowflake. This statement would result in a SQL syntax error.
- B. Incorrect. While `CLONE` is the correct operation, this command omits the time-travel clause (`AT` or `BEFORE`). As a result, it would create a clone of the `PROD` schema in its *current* state, not its state at the specified time yesterday.
- C. Incorrect. The `FROM` keyword is not a valid part of the `CREATE SCHEMA` syntax in Snowflake for copying or cloning another schema. This command would result in a SQL syntax error.
- D. Correct. This command correctly uses the `CLONE` keyword to perform an efficient, metadata-only (zero-copy) clone. Crucially, it includes the `AT(TIMESTAMP => ...)` clause, which leverages Snowflake's Time Travel feature to create the `DEV_V2` schema as an exact copy of the `PROD` schema as it existed at the specified point in time.