20 October 2018        Add to Favorites   Report

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:



Read great educational content like this and a lot more ! Create my free account now 🎁

Copied