diff --git a/sql-statements/sql-statement-create-index.md b/sql-statements/sql-statement-create-index.md index 512e158affd58..d725c687ad8dc 100644 --- a/sql-statements/sql-statement-create-index.md +++ b/sql-statements/sql-statement-create-index.md @@ -111,7 +111,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: @@ -119,7 +119,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: @@ -127,9 +127,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 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: {{< copyable "sql" >}}