This section describes the general syntax of SQL statements, including constants, character sets, data types, SQL attributes, distributed attributes, and storage attributes.
Constants
INT_VALUE: matches an integer constant, such as123.DECIMAL_VALUE: matches a fixed-point constant, such as123.456.STR_VALUE: matches a string constant, such asabc.NULL: matches theNULLconstant.STORAGE_SIZE: matches a storage length constant. The default unit of an integer constant is bytes. The unit of a string constant can be specified as M or G. For example,1024or'500M'.
const_value:
INT_VALUE
| DECIMAL_VALUE
| STR_VALUE
| NULL
| STORAGE_SIZE
STORAGE_SIZE:
INT_VALUE
| 'INT_VALUE[M|G]'
Character sets
charset:
default_charset
| column_charset
default_charset:
[DEFAULT] {CHARSET | CHARACTER SET} [=] charset_name
column_charset:
{CHARSET | CHARACTER SET} charset_name
charset_name:
STR_VALUE
charset_name can be any valid character set name. For more information about character sets, see Compatibility with MySQL.
Collations
collate:
default_collate
| column_collate
default_collate:
[DEFAULT] COLLATE [=] collation_name
column_collate:
COLLATE collation_name
collation_name:
STR_VALUE
collation_name can be any valid collation name. For more information about collations, see Compatibility with MySQL.
Data types
data_type:
TINYINT[(precision)] [UNSIGNED] [ZEROFILL]
| SMALLINT[(precision)] [UNSIGNED] [ZEROFILL]
| MEDIUMINT[(precision)] [UNSIGNED] [ZEROFILL]
| INT[(precision)] [UNSIGNED] [ZEROFILL]
| INTEGER[(precision)] [UNSIGNED] [ZEROFILL]
| BIGINT[(precision)] [UNSIGNED] [ZEROFILL]
| FLOAT[(precision, scale)] [UNSIGNED] [ZEROFILL]
| DOUBLE[(precision, scale)] [UNSIGNED] [ZEROFILL]
| DECIMAL[(precision [, scale])] [UNSIGNED] [ZEROFILL]
| NUMERIC[(precision [, scale])] [UNSIGNED] [ZEROFILL]
| BOOL
| BOOLEAN
| DATETIME[(scale)]
| TIMESTAMP[(scale)]
| DATE
| TIME[(scale)]
| YEAR
| VARCHAR(length) column_charset column_collate
| VARBINARY(length)
| CHAR[(length)] column_charset column_collate
| BINARY[(length)]
| TINYTEXT column_charset column_collate
| TINYBLOB
| TEXT[(length)] column_charset column_collate
| BLOB[(length)]
| MEDIUMTEXT column_charset column_collate
| MEDIUMBLOB
| LONGTEXT column_charset column_collate
| LONGBLOB
| STRING
precision | scale | length:
INT_VALUE
SQL attributes
Object name
tenant_name | pool_name | unit_name | zone_name | region_name: STR_VALUE database_name | table_name | table_alias_name | column_name| column_alias_name | partition_name | subpartition_name: STR_VALUE index_name | view_name | object_name | constraint_name | tablegroup_name: STR_VALUE outline_name | user_name: STR_VALUE table_factor: [[database_name].] table_name column_factor: [table_factor.] column_nameExpression
expression: const_value | column_factor | operator_expression | function_expressionComment
comment: COMMENT 'comment_text' comment_text: STR_VALUE
Distributed attributes
PRIMARY_ZONE: specifies the distribution strategy of the primary replicas of data.primary_zone: PRIMARY_ZONE [=] zone_nameZONE_LIST: specifies the resource distribution strategy of a tenant.zone_list: ZONE_LIST [=] (zone_name [, zone_name ...])REPLICA_NUM: specifies the number of replicas of data.replica_num: REPLICA_NUM [=] INT_VALUETABLEGROUP: specifies the distribution strategy of the primary replicas of multiple data sets.tablegroup: default_tablegroup | table_tablegroup default_tablegroup: DEFAULT TABLEGROUP [=] {tablegroup_name | NULL} table_tablegroup: TABLEGROUP [=] {tablegroup_name | NULL}
Storage attributes
BLOCK_SIZE: specifies the length of microblocks for object storage.block_size: BLOCK_SIZE [=] INT_VALUECOMPRESSION: specifies the compression algorithm for object storage.compression: COMPRESSION [=] {NONE | LZ4_1.0 | LZ0_1.0 | SNAPPY_1.0}PCTFREE: specifies the percentage of macroblocks reserved for object storage.pctfree: PCTFREE [=] INT_VALUETABLET_SIZE: specifies the minimum shard size for a single task during parallel major compactions.tablet_size: TABLET_SIZE [=] INT_VALUE