云数据库 GAUSSDB-CREATE TABLE:语法格式
语法格式
- 创建表。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CREATE [ [ GLOBAL | LOCAL ] [ TEMPORARY | TEMP ] | UN LOG GED ] TABLE [ IF NOT EXISTS ] table_name ({ column_name data_type [ compress_mode ] [ COLLATE collation ] [ column_constraint [ ... ] ] | table_constraint | LIKE source_table [ like_option [...] ] } [, ... ]) [ WITH ( {storage_parameter = value} [, ... ] ) ] [ ON COMMIT { PRESERVE ROWS | DELETE ROWS } ] [ COMPRESS | NOCOMPRESS ] [ TABLESPACE tablespace_name ] [ DISTRIBUTE BY { REPLICATION | HASH ( column_name [, ...] ) | RANGE ( column_name [, ...] ) { SLICE REFEREN CES tablename | ( slice_less_than_item [, ...] ) | ( slice_start_end_item [, ...] ) } | LIST ( column_name [, ...] ) { SLICE REFERENCES tablename | ( slice_values_item [, ...] ) } } ] [ TO { GROUP groupname | NODE ( nodename [, ... ] ) } ];
- 其中列约束column_constraint为:
1 2 3 4 5 6 7 8 9
[ CONSTRAINT constraint_name ] { NOT NULL | NULL | CHECK ( expression ) | DEFAULT default_expr | UNIQUE [ index_parameters ] | PRIMARY KEY [ index_parameters ] | ENCRYPTED WITH ( COLUMN_ENCRYPTION_KEY = column_encryption_key, ENCRYPTION_TYPE = encryption_type_value)} [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
- 其中列的压缩可选项compress_mode为:
1
{ DELTA | PREFIX | DICTIONARY | NUMSTR | NOCOMPRESS }
- 其中表约束table_constraint为:
1 2 3 4 5 6
[ CONSTRAINT constraint_name ] { CHECK ( expression ) | UNIQUE ( column_name [, ... ] ) [ index_parameters ] | PRIMARY KEY ( column_name [, ... ] ) [ index_parameters ] | PARTIAL CLUSTER KEY ( column_name [, ... ] ) } [ DEFERRABLE | NOT DEFERRABLE ][ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
- 其中like选项like_option为:
1
{ INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | INDEXES | STORAGE | COMMENTS | PARTITION | RELOPTIONS | DISTRIBUTION | ALL }
- 其中RANGE分布规则
SLICE slice_name VALUES LESS THAN ({ literal | MAXVALUE } [, ...]) [ DATANODE dn_name ]
slice_start_end_item为:
SLICE slice_name_prefix {
{ START ( literal ) END ( literal ) EVERY ( literal ) } |
{ START ( literal ) END ( { literal | MAXVALUE } ) } |
{ START ( literal ) } |
{ END ( { literal | MAXVALUE } ) }
}
- 其中LIST分布规则slice_values_item为:
SLICE slice_name VALUES (list_values_item) [DATANODE dn_name]
list_values_item为:
{ DEFAULT | { partition_values_list [, ...] } }
partition_values_list为:
{ (literal [, ...]) }
- 其中列约束column_constraint为:
1 2 |
[ WITH ( {storage_parameter = value} [, ... ] ) ] [ USING INDEX TABLESPACE tablespace_name ] |
- GaussDB数据库SQL语法_SQL语法_CREATE_ALTER
- GaussDB版本查询_华为云GaussDB的作用_高斯数据库版本查询_华为云
- BPM流程_BPM的书写格式_BPM产品介绍
- GaussDB(DWS)常用SQL_常用SQL命令_SQL语法
- 什么是Flink OpenSource SQL_数据湖探索_Flink OpenSource SQL
- 日志分析_日志结构化_日志格式化
- 连接RDS for MySQL数据库_华为云数据库RDS_语法_数据库连接_连接命令
- GaussDB(for MySQL)并行查询_GaussDB(for MySQL)内核_GaussDB(for MySQL)并行执行_PQ
- GaussDB主键生成_GaussDB存储过程_高斯数据库主键生成_华为云
- GaussDB Core_gaussdb内核_高斯数据库Core_华为云