20 October 2018        Add to Favorites   Report

CREATE TABLE Statement syntax in Snowflake

Use the create table statement to create a new permanent table:

Example:

create or replace table emp_basic (
first_name string ,
last_name string ,
email string ,
streetaddress string ,
city string ,
start_date date
);

Syntax:

CREATE [ OR REPLACE ] [ { [ LOCAL | GLOBAL ] TEMP[ORARY] | VOLATILE } | TRANSIENT ] TABLE [ IF NOT EXISTS ]
<table_name>
( <col_name> <col_type> [ { DEFAULT <expr>
| { AUTOINCREMENT | IDENTITY } [ ( <start_num> , <step_num> ) | START <num> INCREMENT <num> ] } ]
/* AUTOINCREMENT / IDENTITY supported only for numeric data types (NUMBER, INT, etc.) */
[ inlineConstraint ]
[ , <col_name> <col_type> ... ]
[ , outoflineConstraint ]
[ , ... ] )
[ CLUSTER BY ( <expr> [ , <expr> , ... ] ) ]
[ STAGE_FILE_FORMAT = ( { FORMAT_NAME = '<file_format_name>'
| TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]
[ STAGE_COPY_OPTIONS = ( copyOptions ) ]
[ DATA_RETENTION_TIME_IN_DAYS = <num> ]
[ COPY GRANTS ]
[ COMMENT = '<string_literal>' ]




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

Copied