Skip to content

Commit

Permalink
*: remove unnecessary character from sql examples (#14587) (#14590)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jul 20, 2023
1 parent d240a0b commit 4089437
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions character-set-and-collation.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ MySQL 限制字符集 `utf8` 为最多 3 个字节。这足以存储在基本多

```sql
CREATE TABLE utf8_test (
-> c char(1) NOT NULL
-> ) CHARACTER SET utf8;
c char(1) NOT NULL
) CHARACTER SET utf8;
```

```sql
Expand All @@ -155,8 +155,8 @@ Query OK, 0 rows affected (0.09 sec)

```sql
CREATE TABLE utf8m4_test (
-> c char(1) NOT NULL
-> ) CHARACTER SET utf8mb4;
c char(1) NOT NULL
) CHARACTER SET utf8mb4;
```

```sql
Expand Down
32 changes: 16 additions & 16 deletions partitioned-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ PARTITION BY LIST (store_id) (

```sql
test> CREATE TABLE t (
-> a INT,
-> b INT
-> )
-> PARTITION BY LIST (a) (
-> PARTITION p0 VALUES IN (1, 2, 3),
-> PARTITION p1 VALUES IN (4, 5, 6)
-> );
a INT,
b INT
)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (1, 2, 3),
PARTITION p1 VALUES IN (4, 5, 6)
);
Query OK, 0 rows affected (0.11 sec)

test> INSERT INTO t VALUES (7, 7);
Expand Down Expand Up @@ -539,7 +539,7 @@ MOD(YEAR('2005-09-01'),4)

### Key 分区

TiDB 从 v7.0.0 开始支持 Key 分区。在 v7.0.0 之前的版本中,创建 Key 分区表时,TiDB 会将其创建为非分区表并给出告警。
TiDB 从 v7.0.0 开始支持 Key 分区。在 v7.0.0 之前的版本中,创建 Key 分区表时,TiDB 会将其创建为非分区表并给出告警。

Key 分区与 Hash 分区都可以保证将数据均匀地分散到一定数量的分区里面,区别是 Hash 分区只能根据一个指定的整数表达式或字段进行分区,而 Key 分区可以根据字段列表进行分区,且 Key 分区的分区字段不局限于整数类型。TiDB Key 分区表的 Hash 算法与 MySQL 不一样,因此表的数据分布也不一样。

Expand Down Expand Up @@ -1755,10 +1755,10 @@ set global tidb_partition_prune_mode = dynamic
```sql
mysql> create table t1(id int, age int, key(id)) partition by range(id) (
-> partition p0 values less than (100),
-> partition p1 values less than (200),
-> partition p2 values less than (300),
-> partition p3 values less than (400));
partition p0 values less than (100),
partition p1 values less than (200),
partition p2 values less than (300),
partition p3 values less than (400));
Query OK, 0 rows affected (0.01 sec)
mysql> explain select * from t1 where id < 150;
Expand Down Expand Up @@ -1808,10 +1808,10 @@ mysql> explain select * from t1 where id < 150;
```sql
mysql> create table t1 (id int, age int, key(id)) partition by range(id)
-> (partition p0 values less than (100),
-> partition p1 values less than (200),
-> partition p2 values less than (300),
-> partition p3 values less than (400));
(partition p0 values less than (100),
partition p1 values less than (200),
partition p2 values less than (300),
partition p3 values less than (400));
Query OK, 0 rows affected (0,08 sec)
mysql> create table t2 (id int, code int);
Expand Down
20 changes: 10 additions & 10 deletions sql-statements/sql-statement-create-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ summary: TiDB 数据库中 CREATE [GLOBAL|SESSION] BINDING 的使用概况。

```ebnf+diagram
CreateBindingStmt ::=
'CREATE' GlobalScope 'BINDING' ( 'FOR' BindableStmt 'USING' BindableStmt
'CREATE' GlobalScope 'BINDING' ( 'FOR' BindableStmt 'USING' BindableStmt
| 'FROM' 'HISTORY' 'USING' 'PLAN' 'DIGEST' PlanDigest )
GlobalScope ::=
Expand All @@ -30,18 +30,18 @@ BindableStmt ::=
## 示例

你可以根据 SQL 或历史执行计划创建绑定。

下面的示例演示如何根据 SQL 创建绑定。

{{< copyable "sql" >}}

```sql
CREATE TABLE t1 (
-> id INT NOT NULL PRIMARY KEY auto_increment,
-> b INT NOT NULL,
-> pad VARBINARY(255),
-> INDEX(b)
-> );
id INT NOT NULL PRIMARY KEY auto_increment,
b INT NOT NULL,
pad VARBINARY(255),
INDEX(b)
);
Query OK, 0 rows affected (0.07 sec)

INSERT INTO t1 SELECT NULL, FLOOR(RAND()*1000), RANDOM_BYTES(255) FROM dual;
Expand Down Expand Up @@ -94,9 +94,9 @@ EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
3 rows in set (0.02 sec)

CREATE SESSION BINDING FOR
-> SELECT * FROM t1 WHERE b = 123
-> USING
-> SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
SELECT * FROM t1 WHERE b = 123
USING
SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
Query OK, 0 rows affected (0.00 sec)

EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
Expand Down
6 changes: 3 additions & 3 deletions sql-statements/sql-statement-create-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ DESC t1;
mysql> DROP TABLE IF EXISTS t1;
Query OK, 0 rows affected (0.22 sec)
mysql> CREATE TABLE IF NOT EXISTS t1 (
-> id BIGINT NOT NULL PRIMARY KEY auto_increment,
-> b VARCHAR(200) NOT NULL
-> );
id BIGINT NOT NULL PRIMARY KEY auto_increment,
b VARCHAR(200) NOT NULL
);
Query OK, 0 rows affected (0.08 sec)
mysql> DESC t1;
+-------+--------------+------+------+---------+----------------+
Expand Down
18 changes: 9 additions & 9 deletions sql-statements/sql-statement-drop-binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ summary: TiDB 数据库中 DROP [GLOBAL|SESSION] BINDING 的使用概况。

```ebnf+diagram
DropBindingStmt ::=
'DROP' GlobalScope 'BINDING' 'FOR' ( BindableStmt ( 'USING' BindableStmt )?
'DROP' GlobalScope 'BINDING' 'FOR' ( BindableStmt ( 'USING' BindableStmt )?
| 'SQL' 'DIGEST' SqlDigest)
GlobalScope ::=
Expand All @@ -33,11 +33,11 @@ BindableStmt ::=

```sql
CREATE TABLE t1 (
-> id INT NOT NULL PRIMARY KEY auto_increment,
-> b INT NOT NULL,
-> pad VARBINARY(255),
-> INDEX(b)
-> );
id INT NOT NULL PRIMARY KEY auto_increment,
b INT NOT NULL,
pad VARBINARY(255),
INDEX(b)
);
Query OK, 0 rows affected (0.07 sec)

INSERT INTO t1 SELECT NULL, FLOOR(RAND()*1000), RANDOM_BYTES(255) FROM dual;
Expand Down Expand Up @@ -90,9 +90,9 @@ EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
3 rows in set (0.02 sec)

CREATE SESSION BINDING FOR
-> SELECT * FROM t1 WHERE b = 123
-> USING
-> SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
SELECT * FROM t1 WHERE b = 123
USING
SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
Query OK, 0 rows affected (0.00 sec)

EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
Expand Down
16 changes: 8 additions & 8 deletions sql-statements/sql-statement-show-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ SHOW [GLOBAL | SESSION] BINDINGS [ShowLikeOrWhereOpt];

```sql
CREATE TABLE t1 (
-> id INT NOT NULL PRIMARY KEY auto_increment,
-> b INT NOT NULL,
-> pad VARBINARY(255),
-> INDEX(b)
-> );
id INT NOT NULL PRIMARY KEY auto_increment,
b INT NOT NULL,
pad VARBINARY(255),
INDEX(b)
);
Query OK, 0 rows affected (0.07 sec)

INSERT INTO t1 SELECT NULL, FLOOR(RAND()*1000), RANDOM_BYTES(255) FROM dual;
Expand Down Expand Up @@ -110,9 +110,9 @@ EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
3 rows in set (0.02 sec)

CREATE SESSION BINDING FOR
-> SELECT * FROM t1 WHERE b = 123
-> USING
-> SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
SELECT * FROM t1 WHERE b = 123
USING
SELECT * FROM t1 IGNORE INDEX (b) WHERE b = 123;
Query OK, 0 rows affected (0.00 sec)

EXPLAIN ANALYZE SELECT * FROM t1 WHERE b = 123;
Expand Down
12 changes: 6 additions & 6 deletions transaction-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ ROLLBACK;

```sql
mysql> CREATE TABLE t1 (
-> id INT NOT NULL PRIMARY KEY auto_increment,
-> pad1 VARCHAR(100)
-> );
id INT NOT NULL PRIMARY KEY auto_increment,
pad1 VARCHAR(100)
);
Query OK, 0 rows affected (0.09 sec)

mysql> SELECT @@autocommit;
Expand Down Expand Up @@ -131,9 +131,9 @@ COMMIT;

```sql
mysql> CREATE TABLE t2 (
-> id INT NOT NULL PRIMARY KEY auto_increment,
-> pad1 VARCHAR(100)
-> );
id INT NOT NULL PRIMARY KEY auto_increment,
pad1 VARCHAR(100)
);
Query OK, 0 rows affected (0.10 sec)

mysql> SELECT @@autocommit;
Expand Down

0 comments on commit 4089437

Please sign in to comment.