20 October 2018 · n-pacha ·       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:


n-pacha

posted on 20 October 2018

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too

Copied