Skip to content

Commit b6006f3

Browse files
authored
Merge pull request #685 from zhyass/feature_set
docs: update sql_statements
2 parents eb27fd4 + adf5ccb commit b6006f3

File tree

2 files changed

+103
-5
lines changed

2 files changed

+103
-5
lines changed

docs/sql_statements/data_definition_statements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ table_option: {
319319
}
320320
321321
partition_options:
322-
PARTITION BY HASH(shard-key)
322+
PARTITION BY HASH(shard-key) [PARTITIONS num]
323323
| PARTITION BY LIST(shard-key)(PARTITION backend VALUES IN (value_list),...)
324324
| SINGLE
325325
| GLOBAL
@@ -338,7 +338,7 @@ With MySQL compatibility:
338338
* With `GLOBAL` will create a global table. The global table has full data at every backend. The global tables are generally used for tables with fewer changes and smaller capacity, requiring frequent association with other tables.
339339
* With `SINGLE` will create a single table. The single table only on the first backend.
340340
* With `DISTRIBUTED BY (backend-name)` will create a single table. The single table is distributed on the specified backend `backend-name`.
341-
* With `PARTITION BY HASH(shard-key)` will create a hash partition table. The partition mode is HASH, which is evenly distributed across the partitions according to the partition key `HASH value`
341+
* With `PARTITION BY HASH(shard-key)` will create a hash partition table. The partition mode is HASH, which is evenly distributed across the partitions according to the partition key `HASH value`, `PARTITIONS num` can specify the partition number.
342342
* Without `PARTITION BY HASH(shard-key)|LIST(shard-key)|SINGLE|GLOBAL` will create a hash partition table. The table's `PRIMARY|UNIQUE KEY` is the partition key, only support one primary|unique key.
343343
* With `PARTITION BY LIST(shard-key)` will create a list partition table. `PARTITION backend VALUES IN (value_list)` is one partition, The variable backend is one backend name, The variable value_list is values with `,`.
344344
* all expected values for the partitioning expression should be covered in `PARTITION ... VALUES IN (...)` clauses. An INSERT statement containing an unmatched partitioning column value fails with an error, as shown in this example:

docs/sql_statements/database_administration_statements.md

Lines changed: 101 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ Table of Contents
66
* [CHECKSUM TABLE](#checksum-table)
77
* [SET](#set)
88
* [SHOW](#show)
9+
* [SHOW CHARSET](#show-charset)
10+
* [SHOW COLLATION](#show-collation)
911
* [SHOW ENGINES](#show-engines)
1012
* [SHOW DATABASES](#show-databases)
1113
* [SHOW TABLES](#show-tables)
1214
* [SHOW TABLE STATUS](#show-table-status)
1315
* [SHOW COLUMNS](#show-columns)
1416
* [SHOW CREATE TABLE](#show-create-table)
17+
* [SHOW INDEX](#show-index)
1518
* [SHOW PROCESSLIST](#show-processlist)
1619
* [SHOW VARIABLES](#show-variables)
1720
* [KILL](#kill)
@@ -51,8 +54,66 @@ mysql> checksum table test.t1;
5154
`Instructions`
5255
* For compatibility JDBC/mydumper
5356
* SET is an empty operation, *all operations will not take effect*, do not use it directly。
57+
5458
## SHOW
5559

60+
### SHOW CHARSET
61+
62+
`Syntax`
63+
```
64+
SHOW CHARSET
65+
```
66+
67+
`Instructions`
68+
* This statement lists all available character sets.
69+
70+
`Example: `
71+
```
72+
mysql> show charset;
73+
+----------+---------------------------------+---------------------+--------+
74+
| Charset | Description | Default collation | Maxlen |
75+
+----------+---------------------------------+---------------------+--------+
76+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
77+
| dec8 | DEC West European | dec8_swedish_ci | 1 |
78+
| cp850 | DOS West European | cp850_general_ci | 1 |
79+
| hp8 | HP West European | hp8_english_ci | 1 |
80+
| koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 |
81+
| latin1 | cp1252 West European | latin1_swedish_ci | 1 |
82+
| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |
83+
| swe7 | 7bit Swedish | swe7_swedish_ci | 1 |
84+
... ...
85+
41 rows in set (0.02 sec)
86+
```
87+
88+
### SHOW COLLATION
89+
90+
`Syntax`
91+
```
92+
SHOW COLLATION
93+
```
94+
95+
`Instructions`
96+
* This statement lists collations supported by the server.
97+
98+
`Example: `
99+
```
100+
mysql> SHOW COLLATION;
101+
+--------------------------+----------+-----+---------+----------+---------+
102+
| Collation | Charset | Id | Default | Compiled | Sortlen |
103+
+--------------------------+----------+-----+---------+----------+---------+
104+
| big5_chinese_ci | big5 | 1 | Yes | Yes | 1 |
105+
| big5_bin | big5 | 84 | | Yes | 1 |
106+
| dec8_swedish_ci | dec8 | 3 | Yes | Yes | 1 |
107+
| dec8_bin | dec8 | 69 | | Yes | 1 |
108+
| cp850_general_ci | cp850 | 4 | Yes | Yes | 1 |
109+
| cp850_bin | cp850 | 80 | | Yes | 1 |
110+
| hp8_english_ci | hp8 | 6 | Yes | Yes | 1 |
111+
| hp8_bin | hp8 | 72 | | Yes | 1 |
112+
| koi8r_general_ci | koi8r | 7 | Yes | Yes | 1 |
113+
... ...
114+
222 rows in set (0.05 sec)
115+
```
116+
56117
### SHOW ENGINES
57118

58119
`Syntax`
@@ -162,9 +223,10 @@ mysql> show table status;
162223
`Syntax`
163224

164225
```
165-
SHOW [FULL] {COLUMNS | FIELDS}
166-
FROM [db_name.]table_name
167-
[LIKE 'pattern' | WHERE expr]
226+
SHOW [FULL] {COLUMNS | FIELDS}
227+
{FROM | IN} tbl_name
228+
[{FROM | IN} db_name]
229+
[LIKE 'pattern' | WHERE expr]
168230
```
169231

170232
`Instructions`
@@ -217,6 +279,42 @@ Create Table: CREATE TABLE `t1` (
217279
1 row in set (0.094 sec)
218280
```
219281

282+
### SHOW INDEX
283+
284+
`Syntax`
285+
```
286+
SHOW {INDEX | INDEXES | KEYS}
287+
{FROM | IN} tbl_name
288+
[{FROM | IN} db_name]
289+
[WHERE expr]
290+
```
291+
292+
`Instructions`
293+
* Get the table index information.
294+
295+
`Example: `
296+
```
297+
mysql> CREATE TABLE t1(A INT PRIMARY KEY, B VARCHAR(10)) PARTITION BY HASH(A);
298+
Query OK, 0 rows affected (2.20 sec)
299+
300+
mysql> show index from t1\G
301+
*************************** 1. row ***************************
302+
Table: t1
303+
Non_unique: 0
304+
Key_name: PRIMARY
305+
Seq_in_index: 1
306+
Column_name: A
307+
Collation: A
308+
Cardinality: 0
309+
Sub_part: NULL
310+
Packed: NULL
311+
Null:
312+
Index_type: BTREE
313+
Comment:
314+
Index_comment:
315+
1 row in set (0.05 sec)
316+
```
317+
220318
### SHOW PROCESSLIST
221319

222320
`Syntax`

0 commit comments

Comments
 (0)