From a566d60a510ab49c6a8b766db3c1f735300186d5 Mon Sep 17 00:00:00 2001 From: shichun-0415 Date: Fri, 17 Sep 2021 16:56:54 +0800 Subject: [PATCH 1/2] fix example for expression index --- sql-statements/sql-statement-create-index.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sql-statements/sql-statement-create-index.md b/sql-statements/sql-statement-create-index.md index be50e19071f7c..e98d374c90ec1 100644 --- a/sql-statements/sql-statement-create-index.md +++ b/sql-statements/sql-statement-create-index.md @@ -110,7 +110,7 @@ For example, if you want to create an index based on `lower(col1)`, execute the {{< copyable "sql" >}} ```sql -CREATE INDEX idx1 ON t1 (lower(col1)); +CREATE INDEX idx1 ON t1 ((lower(col1))); ``` Or you can execute the following equivalent statement: @@ -118,7 +118,7 @@ Or you can execute the following equivalent statement: {{< copyable "sql" >}} ```sql -ALTER TABLE t1 ADD INDEX idx1(lower(col1)); +ALTER TABLE t1 ADD INDEX idx1((lower(col1))); ``` You can also specify the expression index when you create the table: @@ -126,9 +126,13 @@ You can also specify the expression index when you create the table: {{< copyable "sql" >}} ```sql -CREATE TABLE t1(col1 char(10), col2 char(10), key index(lower(col1))); +CREATE TABLE t1(col1 char(10), col2 char(10), key index((lower(col1)))); ``` +> **Note** +> +> The expression in the expression index must be surrounded by '(' and ')'. Otherwise, a syntax error will be reported. + You can drop an expression index in the same way as dropping an ordinary index: {{< copyable "sql" >}} From d61711f2eccd2d2dc1d756ce9c0e2297a9447a1d Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 29 Sep 2021 14:40:45 +0800 Subject: [PATCH 2/2] Update sql-statements/sql-statement-create-index.md --- sql-statements/sql-statement-create-index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-create-index.md b/sql-statements/sql-statement-create-index.md index e98d374c90ec1..583b2dd1655e2 100644 --- a/sql-statements/sql-statement-create-index.md +++ b/sql-statements/sql-statement-create-index.md @@ -131,7 +131,7 @@ CREATE TABLE t1(col1 char(10), col2 char(10), key index((lower(col1)))); > **Note** > -> The expression in the expression index must be surrounded by '(' and ')'. Otherwise, a syntax error will be reported. +> The expression in an expression index must be surrounded by '(' and ')'. Otherwise, a syntax error is reported. You can drop an expression index in the same way as dropping an ordinary index: