CREATE TABLE LIKE Statement in Snowflake (Copies only DDL)

To copy only the structure and not the data, Use the LIKE Command: 

create table mytable_copy like mytable;

NOTE: The above command creates an empty copy of an existing table

Syntax:

Creates a new table with the same column definitions as an existing table, but without copying data from the existing table. Column names, types, defaults, and constraints are copied to the new table:

CREATE [ OR REPLACE ] TABLE <table_name> LIKE <source_table>
[ CLUSTER BY ( <expr> [ , <expr> , ... ] ) ]
[ COPY GRANTS ]
[ ... ]

Also, see:

nVector

posted on 20 Oct 18

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds