How to Duplicate a Table in Snowflake

In Snowflake, we will duplicate the table through “copy clone” and “copy as” commands. We can primarily use them for creating schemas, tables, and databases. In this blog, we will learn to duplicate the tables in Snowflake.

Duplicate a Table in Snowflake

To duplicate a table, we have various methods. As per our intent, we will use the method. 

Copy both the data and table structure include:

Method1:

create table sessions1_copy clone sessions1;

Method2:

create table sessions1_copy as
select *
From sessions1;

Copy only specific columns into the fresh table along with the specific data set:

Create table sessions1_dm_2_copy as
select
id1,
start_date1,
end_date1
from sessions_dm_1
where category = 2;

Copy only specific columns from multiple tables into the latest table with specific data set:

create table users1_sessions12_rpt as
select*
u1.name,
s.start_date1 as session_start_date,
s.end_date1 as session.end_date1,
from sessions1 s
left join user_sessions us on s.id1 = us. session.id1
left join users_1 u on us. user_id1 = u.id1
where u1.active = true;

Copy only table structure, not data

create table users1_copy like users1;
MindMajix Logo

Subscribe to explore the latest tech updates, career transformation tips, and much more.

Conclusion

Cloning the data objects will replicate the data, structure, and particular properties of source table. The cloned table will not have the loading history of source table. I hope this blog provides you with the information about Duplicating tables.

Snowflake Related Articles


▶  Snowflake vs Redshift
▶  Snowflake vs BigQuery
▶  Snowflake vs Databricks
▶  Snowflake vs Azure
▶  Snowflake vs Hadoop
▶  Snowflake Time Travel

If you have any queries, let us know by commenting below.

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Snowflake TrainingNov 19 to Dec 04View Details
Snowflake TrainingNov 23 to Dec 08View Details
Snowflake TrainingNov 26 to Dec 11View Details
Snowflake TrainingNov 30 to Dec 15View Details
Last updated: 19 May 2022
About Author

Keerthi Sai is a Senior Writer at Mindmajix with tons of content creation experience in the areas of cloud computing, BI, Perl Scripting. She also creates content on Salesforce, Microstrategy, and Cobit.

read less
  1. Share:
Snowflake Articles