Bird
Raised Fist0
Snowflakecloud~10 mins

Clone use cases (dev, testing, backups) in Snowflake - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - Clone use cases (dev, testing, backups)
Original Database/Table
↓
Create Clone
↓
Clone is Independent
↓
Use Clone for Dev/Testing/Backup
↓
Changes in Clone do NOT affect Original
↓
Optionally Refresh or Drop Clone
Start with an original database or table, create a clone that is independent, then use it safely for development, testing, or backups without affecting the original.
Execution Sample
Snowflake
CREATE DATABASE prod_db;
CREATE DATABASE dev_db CLONE prod_db;
-- Use dev_db for testing
DROP DATABASE dev_db;
Create a production database, clone it for development, then drop the clone after testing.
Process Table
StepActionObject StateResult
1CREATE DATABASE prod_dbprod_db createdEmpty database ready for data
2CREATE DATABASE dev_db CLONE prod_dbprod_db unchanged, dev_db clone createddev_db is a snapshot clone of prod_db
3Insert test data into dev_dbprod_db unchanged, dev_db modifiedChanges only in dev_db, prod_db safe
4Run tests on dev_dbprod_db unchanged, dev_db modifiedTesting isolated from prod_db
5DROP DATABASE dev_dbprod_db unchanged, dev_db removedClone removed, prod_db intact
💡 Clone dropped after testing, original database remains unchanged
Status Tracker
ObjectInitialAfter CloneAfter Test Data InsertAfter Drop Clone
prod_dbNot existExists (original)Exists (original)Exists (original)
dev_dbNot existExists (clone of prod_db)Exists (clone with test data)Not exist
Key Moments - 3 Insights
Does modifying the clone affect the original database?
No, as shown in steps 3 and 4 of the execution_table, changes in the clone (dev_db) do not affect the original (prod_db).
Can the clone be used for backup purposes?
Yes, because the clone is a snapshot of the original at creation time, it can serve as a backup without impacting the original data.
What happens when the clone is dropped?
Dropping the clone removes only the clone (dev_db) and leaves the original (prod_db) unchanged, as shown in step 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the state of prod_db after step 3?
Aprod_db has test data inserted
Bprod_db remains unchanged
Cprod_db is dropped
Dprod_db is cloned again
💡 Hint
Refer to the 'Object State' column in step 3 of the execution_table
At which step is the clone dev_db removed?
AStep 5
BStep 3
CStep 2
DStep 4
💡 Hint
Check the 'Action' column for when DROP DATABASE dev_db occurs
If you insert data into the clone, what happens to the original database?
AOriginal database also gets the data
BOriginal database is deleted
COriginal database remains unchanged
DOriginal database is renamed
💡 Hint
See steps 3 and 4 in the execution_table for how changes affect prod_db
Concept Snapshot
Snowflake clones create independent copies of databases or tables.
Clones share storage initially but changes are isolated.
Use clones for development, testing, or backups safely.
Dropping a clone does not affect the original.
Cloning is fast and storage-efficient.
Full Transcript
This visual execution shows how Snowflake clones work. First, an original database is created. Then a clone is made, which is an independent snapshot. You can insert test data and run tests on the clone without changing the original. Finally, the clone can be dropped safely. This process supports development, testing, and backup use cases by isolating changes and preserving the original data.

Practice

(1/5)
1. What is the main benefit of using CLONE in Snowflake for development?
easy
A. It moves data to a different cloud provider automatically.
B. It permanently deletes the original data after copying.
C. It creates a quick, space-saving copy of data without affecting the original.
D. It encrypts the data for security during development.

Solution

  1. Step 1: Understand cloning purpose in development

    Cloning creates a copy of data instantly without changing the original, allowing safe development.
  2. Step 2: Identify benefits of cloning

    It saves storage by sharing unchanged data and avoids risks to original data.
  3. Final Answer:

    It creates a quick, space-saving copy of data without affecting the original. -> Option C
  4. Quick Check:

    Clone = quick, safe copy [OK]
Hint: Clones copy data fast without changing original [OK]
Common Mistakes:
  • Thinking clone deletes original data
  • Believing clone moves data between clouds
  • Confusing clone with encryption
2. Which of the following is the correct syntax to clone a table named sales_data in Snowflake?
easy
A. CREATE TABLE sales_data_clone CLONE sales_data;
B. CREATE TABLE sales_data_clone AS CLONE sales_data;
C. CLONE TABLE sales_data TO sales_data_clone;
D. COPY TABLE sales_data TO sales_data_clone;

Solution

  1. Step 1: Recall Snowflake clone syntax

    The correct syntax is CREATE TABLE new_table CLONE source_table;.
  2. Step 2: Match syntax to options

    CREATE TABLE sales_data_clone CLONE sales_data; matches the correct syntax exactly.
  3. Final Answer:

    CREATE TABLE sales_data_clone CLONE sales_data; -> Option A
  4. Quick Check:

    CREATE TABLE ... CLONE ... = correct syntax [OK]
Hint: Use CREATE TABLE new_table CLONE source_table syntax [OK]
Common Mistakes:
  • Using AS CLONE instead of CLONE
  • Using COPY instead of CLONE
  • Incorrect order of keywords
3. Given the following commands:
CREATE TABLE orders (id INT, amount FLOAT);
INSERT INTO orders VALUES (1, 100.0), (2, 200.0);
CREATE TABLE orders_clone CLONE orders;
INSERT INTO orders_clone VALUES (3, 300.0);
SELECT COUNT(*) FROM orders;

What will be the result of the SELECT COUNT(*) FROM orders; query?
medium
A. 2
B. 3
C. 0
D. Error

Solution

  1. Step 1: Understand cloning effect on data

    Cloning creates a copy at that moment. Changes to clone do not affect original.
  2. Step 2: Analyze inserts and counts

    Original table has 2 rows inserted. The clone gets a new row inserted separately.
  3. Step 3: Query original table count

    Original table still has 2 rows; clone changes do not affect it.
  4. Final Answer:

    2 -> Option A
  5. Quick Check:

    Original rows unchanged after clone insert [OK]
Hint: Clone changes don't affect original data count [OK]
Common Mistakes:
  • Assuming clone insert adds to original
  • Thinking clone shares insert changes
  • Expecting error due to cloning
4. You cloned a database for testing but later found that some data changes in the clone are missing. Which is the most likely cause?
medium
A. You forgot to commit the changes in the clone before querying.
B. Cloning only copies metadata, not data.
C. Changes were made in the original, not the clone.
D. You cloned the database before the data was inserted.

Solution

  1. Step 1: Understand cloning timing

    Cloning copies data as it exists at clone time; later changes in source are not included.
  2. Step 2: Analyze missing data cause

    If clone was made before data insertion, clone won't have that data.
  3. Final Answer:

    You cloned the database before the data was inserted. -> Option D
  4. Quick Check:

    Clone snapshot time matters for data presence [OK]
Hint: Clone captures data state at clone time only [OK]
Common Mistakes:
  • Assuming clone updates with source changes
  • Confusing metadata-only clone
  • Forgetting to commit changes
5. You want to create a backup of a large production schema without using extra storage. Which Snowflake feature should you use and why?
hard
A. Use CREATE DATABASE AS COPY which compresses data automatically.
B. Use CLONE to create a schema copy because it shares unchanged data and saves storage.
C. Create a new schema and manually copy all tables to save storage.
D. Export data to CSV files and store externally for backup.

Solution

  1. Step 1: Identify backup needs

    Backup should be space-efficient and quick for large data.
  2. Step 2: Evaluate Snowflake features

    Cloning creates instant copies sharing unchanged data, saving storage space.
  3. Step 3: Compare options

    Exporting or manual copying uses more storage and time; no CREATE DATABASE AS COPY command exists.
  4. Final Answer:

    Use CLONE to create a schema copy because it shares unchanged data and saves storage. -> Option B
  5. Quick Check:

    Clone = instant, space-saving backup [OK]
Hint: Clone shares data, saves space for backups [OK]
Common Mistakes:
  • Thinking manual copy saves storage
  • Assuming export is space-efficient
  • Using non-existent commands
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard