📖 Scenario: You work as a data engineer at a company that uses Snowflake for data warehousing. Your team wants to create a copy of an existing database to test new features without using extra storage space.Snowflake's zero-copy cloning allows you to create a clone of a database instantly without duplicating the data physically.
🎯 Goal: Create a zero-copy clone of an existing database in Snowflake to enable safe testing without extra storage costs.
📋 What You'll Learn
Create a database named sales_db with a sample table
Set a variable for the clone database name sales_db_clone
Use zero-copy cloning to create sales_db_clone from sales_db
Verify the clone database exists
💡 Why This Matters
🌍 Real World
Zero-copy cloning helps data teams create test or development copies of large datasets instantly without extra storage costs.
💼 Career
Data engineers and cloud architects use zero-copy cloning to manage data environments efficiently and safely.
Progress0 / 4 steps
1
Create the original database and table
Write SQL commands to create a database called sales_db and a table called orders inside it with columns order_id (integer) and amount (decimal). Insert one row with order_id = 1 and amount = 100.00.
Snowflake
Hint
Use CREATE DATABASE to make the database, then CREATE TABLE inside it, and INSERT INTO to add data.
2
Set the clone database name variable
Declare a variable called clone_db_name and set it to the string 'sales_db_clone'.
Snowflake
Hint
Use SET to declare a variable in Snowflake SQL.
3
Create the zero-copy clone database
Write a SQL command to create a clone database named using the variable clone_db_name from the existing sales_db database using zero-copy cloning.
Snowflake
Hint
Use CREATE DATABASE IDENTIFIER($clone_db_name) CLONE sales_db; to create the clone using the variable.
4
Verify the clone database exists
Write a SQL query to list all databases and check that sales_db_clone is present.
Snowflake
Hint
Use SHOW DATABASES LIKE 'sales_db_clone'; to verify the clone exists.
Practice
(1/5)
1. What is the main benefit of zero-copy cloning in Snowflake?
easy
A. It deletes the original data after cloning.
B. It compresses data to save storage space.
C. It encrypts data automatically during cloning.
D. It creates instant copies without duplicating the original data.
Solution
Step 1: Understand zero-copy cloning concept
Zero-copy cloning creates a copy of data instantly without physically duplicating the data.
Step 2: Identify the main benefit
This saves storage and time because the clone shares the original data until changes are made.
Final Answer:
It creates instant copies without duplicating the original data. -> Option D
Quick Check:
Zero-copy cloning = instant copy without duplication [OK]
Hint: Zero-copy cloning shares data, no extra storage used [OK]
Common Mistakes:
Thinking cloning duplicates all data immediately
Confusing cloning with data encryption
Assuming original data is deleted after cloning
2. Which of the following is the correct syntax to create a zero-copy clone of a table named sales_data in Snowflake?
easy
A. CREATE TABLE sales_data_clone AS CLONE sales_data;
B. CREATE CLONE sales_data_clone FROM sales_data;
C. CREATE TABLE sales_data_clone CLONE sales_data;
D. CLONE TABLE sales_data TO sales_data_clone;
Solution
Step 1: Recall Snowflake cloning syntax
The correct syntax to clone a table is: CREATE TABLE new_table CLONE original_table;
Step 2: Match syntax with options
CREATE TABLE sales_data_clone CLONE sales_data; matches the correct syntax exactly.
Final Answer:
CREATE TABLE sales_data_clone CLONE sales_data; -> Option C
Quick Check:
CREATE TABLE ... CLONE ... is correct syntax [OK]
Hint: Use CREATE TABLE new_table CLONE original_table [OK]
Common Mistakes:
Using CREATE CLONE instead of CREATE TABLE ... CLONE
Adding AS before CLONE incorrectly
Using CLONE TABLE ... TO syntax which is invalid
3. Consider this Snowflake SQL snippet:
CREATE TABLE original (id INT, value STRING); INSERT INTO original VALUES (1, 'A'), (2, 'B'); CREATE TABLE clone_table CLONE original; INSERT INTO clone_table VALUES (3, 'C'); SELECT COUNT(*) FROM original;
What will be the output of the SELECT query?
medium
A. 2
B. Error
C. 0
D. 3
Solution
Step 1: Understand cloning and data insertion
The clone_table is a zero-copy clone of original, sharing data initially. Inserting into clone_table does not affect original.
Step 2: Count rows in original table
Original has 2 rows inserted initially and remains unchanged after clone_table insert.
Final Answer:
2 -> Option A
Quick Check:
Original rows unchanged after clone insert [OK]
Hint: Inserts to clone don't affect original table [OK]
Common Mistakes:
Assuming insert in clone adds rows to original
Thinking clone is a full independent copy immediately
Expecting error due to cloning
4. You tried to create a zero-copy clone of a database using:
CREATE DATABASE clone_db CLONE original_db;
But received an error. What is the most likely cause?
medium
A. The original database does not exist.
B. You cannot clone a database, only tables.
C. The clone syntax requires the keyword TABLE.
D. You need to specify a schema when cloning a database.
Solution
Step 1: Check cloning rules for databases
Snowflake supports cloning databases if the original database exists.
Step 2: Identify error cause
If the original_db does not exist, cloning fails with an error.
Final Answer:
The original database does not exist. -> Option A
Quick Check:
Cloning requires existing source database [OK]
Hint: Ensure original database exists before cloning [OK]
Common Mistakes:
Thinking databases cannot be cloned
Adding TABLE keyword incorrectly
Assuming schema must be specified
5. You want to create a zero-copy clone of a large table for testing, but only want to clone data as it was at a specific past time. Which Snowflake feature should you use with cloning?
hard
A. Use a full data export and import instead of cloning.
B. Use Time Travel to specify the past timestamp during cloning.
C. Clone the table and then manually delete unwanted rows.
D. Use a materialized view to clone the data at that time.
Solution
Step 1: Understand cloning with Time Travel
Snowflake allows cloning data as it existed at a past time using Time Travel feature.
Step 2: Apply Time Travel in cloning
You specify the timestamp or offset in the clone statement to get data snapshot at that time.
Final Answer:
Use Time Travel to specify the past timestamp during cloning. -> Option B
Quick Check:
Time Travel + cloning = snapshot at past time [OK]
Hint: Combine Time Travel with clone for past data snapshot [OK]
Common Mistakes:
Thinking cloning alone can get past data
Using export/import which is slower
Using materialized views which don't clone data
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.