通用语法 
=========================



常量 
-----------

* `INT_VALUE`：匹配整数类型常量，如`123`。




<!-- -->

* `DECIMAL_VALUE`：匹配定点类型常量，如`123.456`。




<!-- -->

* `STR_VALUE`：匹配字符串常量，如`abc`。




<!-- -->

* `NULL`：匹配NULL常量。




<!-- -->

* `STORAGE_SIZE`：匹配存储长度常量，整数形式默认单位为字节，字符串形式可指定单位为M或G，如`1024`或`'500M'`。




```javascript
const_value:
      INT_VALUE
    | DECIMAL_VALUE
    | STR_VALUE
    | NULL
    | STORAGE_SIZE

STORAGE_SIZE:
      INT_VALUE
    | 'INT_VALUE[M|G]'
```





字符集 
------------

```javascript
charset:
      default_charset
    | column_charset

default_charset:
    [DEFAULT] {CHARSET | CHARACTER SET} [=] {UTF8 | UTF8MB4 | BINARY}

column_charset:
    {CHARSET | CHARACTER SET} {UTF8 | UTF8MB4 | BINARY}
```





排序规则 
-------------

```javascript
collate:
      default_collate
    | column_collate

default_collate:
    [DEFAULT] COLLATE [=] {UTF8MB4_GENERAL_CI | UTF8MB4_BIN | BINARY}

column_collate:
    COLLATE {UTF8MB4_GENERAL_CI | UTF8MB4_BIN | BINARY}
```





数据类型 
-------------

```javascript
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] 
    | 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
    | TINYLOB
    | TEXT[(length)] column_charset column_collate
    | BLOB[(length)]
    | MEDIUMTEXT column_charset column_collate
    | MEDIUMBLOB
    | LONGTEXT column_charset column_collate
    | LONGBLOB

precision | scale | length:
    INT_VALUE
```





SQL属性 
--------------

* 对象名




```javascript
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_name
```





* 表达式




```javascript
expression:
      const_value
    | column_factor
    | operator_expression
    | function_expression
```





* 注释




```javascript
comment:
    COMMENT 'comment_text'

comment_text:
    STR_VALUE
```





分布式属性 
--------------



* `PRIMARY_ZONE`：指定数据的主副本分布策略。




```javascript
primary_zone:
PRIMARY_ZONE [=] zone_name
```





* `ZONE_LIST`：指定租户的资源分布策略。




```javascript
zone_list:
ZONE_LIST [=] (zone_name [, zone_name ...])
```





* `REPLICA_NUM`：指定数据的副本份数。




```javascript
replica_num:
REPLICA_NUM [=] INT_VALUE
```





* `TABLEGROUP`：指定多份数据的主副本分布策略。




```javascript
tablegroup:
      default_tablegroup
    | table_tablegroup

default_tablegroup:
    DEFAULT TABLEGROUP [=] {tablegroup_name | NULL}

table_tablegroup:
    TABLEGROUP [=] {tablegroup_name | NULL}
```





存储属性 
-------------



* `BLOCK_SIZE`：指定对象存储的微块长度。




```javascript
block_size:
BLOCK_SIZE [=] INT_VALUE
```





* `COMPRESSION`：指定对象存储的压缩算法。




```javascript
compression:
COMPRESSION [=] {NONE | LZ4_1.0 | LZ0_1.0 | SNAPPY_1.0 | ZLIB_1.0}
```





* `PCTFREE`：指定对象存储的宏块预留百分比。




```javascript
pctfree:
PCTFREE [=] INT_VALUE
```





* `TABLET_SIZE`：指定并行合并时单个任务的最小分片。




```javascript
tablet_size:
TABLET_SIZE [=] INT_VALUE
```


