@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "ASCII",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# ASCII
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT AXES (WARCHAR STR)`
|
||||
|
||||
|
||||
Returns the ASCII code corresponding to the first character of the string
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select ascii('1');
|
||||
+------------+
|
||||
| ascii('1') |
|
||||
+------------+
|
||||
| 49 |
|
||||
+------------+
|
||||
|
||||
mysql> select ascii('234');
|
||||
+--------------+
|
||||
| ascii('234') |
|
||||
+--------------+
|
||||
| 50 |
|
||||
+--------------+
|
||||
```
|
||||
##keyword
|
||||
ASCII
|
||||
@ -0,0 +1,61 @@
|
||||
---
|
||||
{
|
||||
"title": "concat",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# concat
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`VARCHAR concat (VARCHAR,...)`
|
||||
|
||||
|
||||
Connect multiple strings and return NULL if any of the parameters is NULL
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select concat("a", "b");
|
||||
+------------------+
|
||||
| concat('a', 'b') |
|
||||
+------------------+
|
||||
| ab |
|
||||
+------------------+
|
||||
|
||||
mysql> select concat("a", "b", "c");
|
||||
+-----------------------+
|
||||
| concat('a', 'b', 'c') |
|
||||
+-----------------------+
|
||||
| abc |
|
||||
+-----------------------+
|
||||
|
||||
mysql> select concat("a", null, "c");
|
||||
+------------------------+
|
||||
| concat('a', NULL, 'c') |
|
||||
+------------------------+
|
||||
| NULL |
|
||||
+------------------------+
|
||||
```
|
||||
##keyword
|
||||
CONCAT
|
||||
@ -0,0 +1,63 @@
|
||||
---
|
||||
{
|
||||
"title": "Concat_ws",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# Concat_ws
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR concat ws (VARCHAR sep., VARCHAR str,...)'
|
||||
|
||||
|
||||
Using the first parameter SEP as a connector, the second parameter and all subsequent parameters are spliced into a string.
|
||||
If the separator is NULL, return NULL.
|
||||
` The concat_ws` function does not skip empty strings, but NULL values.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select concat_ws("or", "d", "is");
|
||||
+----------------------------+
|
||||
| concat_ws('or', 'd', 'is') |
|
||||
+----------------------------+
|
||||
| doris |
|
||||
+----------------------------+
|
||||
|
||||
mysql> select concat_ws(NULL, "d", "is");
|
||||
+----------------------------+
|
||||
| concat_ws(NULL, 'd', 'is') |
|
||||
+----------------------------+
|
||||
| NULL |
|
||||
+----------------------------+
|
||||
|
||||
mysql> select concat_ws("or", "d", NULL,"is");
|
||||
+---------------------------------+
|
||||
| concat_ws("or", "d", NULL,"is") |
|
||||
+---------------------------------+
|
||||
| doris |
|
||||
+---------------------------------+
|
||||
```
|
||||
##keyword
|
||||
CONCAT_WS,CONCAT,WS
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "ends_with",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# ends_with
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`BOOLEAN ENDS_WITH (VARCHAR str, VARCHAR suffix)`
|
||||
|
||||
It returns true if the string ends with the specified suffix, otherwise it returns false.
|
||||
If any parameter is NULL, it returns NULL.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select ends_with("Hello doris", "doris");
|
||||
+-----------------------------------+
|
||||
| ends_with('Hello doris', 'doris') |
|
||||
+-----------------------------------+
|
||||
| 1 |
|
||||
+-----------------------------------+
|
||||
|
||||
mysql> select ends_with("Hello doris", "Hello");
|
||||
+-----------------------------------+
|
||||
| ends_with('Hello doris', 'Hello') |
|
||||
+-----------------------------------+
|
||||
| 0 |
|
||||
+-----------------------------------+
|
||||
```
|
||||
##keyword
|
||||
ENDS_WITH
|
||||
@ -0,0 +1,49 @@
|
||||
---
|
||||
{
|
||||
"title": "find_in_set",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# find_in_set
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`INT find_in_set(VARCHAR str, VARCHAR strlist)`
|
||||
|
||||
"NOT found in set (VARCHAR str., VARCHAR strlist)"
|
||||
|
||||
|
||||
Return to the location where the str first appears in strlist (counting from 1). Strlist is a comma-separated string. If not, return 0. Any parameter is NULL, returning NULL.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select find_in_set("b", "a,b,c");
|
||||
+---------------------------+
|
||||
| find_in_set('b', 'a,b,c') |
|
||||
+---------------------------+
|
||||
| 2 |
|
||||
+---------------------------+
|
||||
```
|
||||
##keyword
|
||||
FIND_IN_SET,FIND,IN,SET
|
||||
@ -0,0 +1,74 @@
|
||||
---
|
||||
{
|
||||
"title": "get_json_double",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# get_json_double
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`DOUBLE get_json_double(VARCHAR json_str, VARCHAR json_path)
|
||||
|
||||
|
||||
Parse and get the floating-point content of the specified path in the JSON string.
|
||||
Where json_path must start with the $symbol and use. as the path splitter. If the path contains..., double quotation marks can be used to surround it.
|
||||
Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_double('{"k1":1.3, "k2":"2"}', "$.k1");
|
||||
+-------------------------------------------------+
|
||||
| get_json_double('{"k1":1.3, "k2":"2"}', '$.k1') |
|
||||
+-------------------------------------------------+
|
||||
| 1.3 |
|
||||
+-------------------------------------------------+
|
||||
```
|
||||
|
||||
2. Get the second element of the array whose key is "my. key"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_double('{"k1":"v1", "my.key":[1.1, 2.2, 3.3]}', '$."my.key"[1]');
|
||||
+---------------------------------------------------------------------------+
|
||||
| get_json_double('{"k1":"v1", "my.key":[1.1, 2.2, 3.3]}', '$."my.key"[1]') |
|
||||
+---------------------------------------------------------------------------+
|
||||
| 2.2 |
|
||||
+---------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
3. Get the first element in an array whose secondary path is k1. key - > K2
|
||||
```
|
||||
mysql> SELECT get_json_double('{"k1.key":{"k2":[1.1, 2.2]}}', '$."k1.key".k2[0]');
|
||||
+---------------------------------------------------------------------+
|
||||
| get_json_double('{"k1.key":{"k2":[1.1, 2.2]}}', '$."k1.key".k2[0]') |
|
||||
+---------------------------------------------------------------------+
|
||||
| 1.1 |
|
||||
+---------------------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
GET_JSON_DOUBLE,GET,JSON,DOUBLE
|
||||
@ -0,0 +1,74 @@
|
||||
---
|
||||
{
|
||||
"title": "get_json_int",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# get_json_int
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT get_json_int(VARCHAR json_str, VARCHAR json_path)
|
||||
|
||||
|
||||
Parse and retrieve the integer content of the specified path in the JSON string.
|
||||
Where json_path must start with the $symbol and use. as the path splitter. If the path contains..., double quotation marks can be used to surround it.
|
||||
Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_int('{"k1":1, "k2":"2"}', "$.k1");
|
||||
+--------------------------------------------+
|
||||
| get_json_int('{"k1":1, "k2":"2"}', '$.k1') |
|
||||
+--------------------------------------------+
|
||||
| 1 |
|
||||
+--------------------------------------------+
|
||||
```
|
||||
|
||||
2. Get the second element of the array whose key is "my. key"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_int('{"k1":"v1", "my.key":[1, 2, 3]}', '$."my.key"[1]');
|
||||
+------------------------------------------------------------------+
|
||||
| get_json_int('{"k1":"v1", "my.key":[1, 2, 3]}', '$."my.key"[1]') |
|
||||
+------------------------------------------------------------------+
|
||||
| 2 |
|
||||
+------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
3. Get the first element in an array whose secondary path is k1. key - > K2
|
||||
```
|
||||
mysql> SELECT get_json_int('{"k1.key":{"k2":[1, 2]}}', '$."k1.key".k2[0]');
|
||||
+--------------------------------------------------------------+
|
||||
| get_json_int('{"k1.key":{"k2":[1, 2]}}', '$."k1.key".k2[0]') |
|
||||
+--------------------------------------------------------------+
|
||||
| 1 |
|
||||
+--------------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
GET_JSON_INT,GET,JSON,INT
|
||||
@ -0,0 +1,84 @@
|
||||
---
|
||||
{
|
||||
"title": "get_json_string",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# get_json_string
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR get_json_string (VARCHAR json str, VARCHAR json path)
|
||||
|
||||
|
||||
Parse and retrieve the string content of the specified path in the JSON string.
|
||||
Where json_path must start with the $symbol and use. as the path splitter. If the path contains..., double quotation marks can be used to surround it.
|
||||
Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_string('{"k1":"v1", "k2":"v2"}', "$.k1");
|
||||
+---------------------------------------------------+
|
||||
| get_json_string('{"k1":"v1", "k2":"v2"}', '$.k1') |
|
||||
+---------------------------------------------------+
|
||||
| v1 |
|
||||
+---------------------------------------------------+
|
||||
```
|
||||
|
||||
2. Get the second element of the array whose key is "my. key"
|
||||
|
||||
```
|
||||
mysql> SELECT get_json_string('{"k1":"v1", "my.key":["e1", "e2", "e3"]}', '$."my.key"[1]');
|
||||
+------------------------------------------------------------------------------+
|
||||
| get_json_string('{"k1":"v1", "my.key":["e1", "e2", "e3"]}', '$."my.key"[1]') |
|
||||
+------------------------------------------------------------------------------+
|
||||
| e2 |
|
||||
+------------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
3. Get the first element in an array whose secondary path is k1. key - > K2
|
||||
```
|
||||
mysql> SELECT get_json_string('{"k1.key":{"k2":["v1", "v2"]}}', '$."k1.key".k2[0]');
|
||||
+-----------------------------------------------------------------------+
|
||||
| get_json_string('{"k1.key":{"k2":["v1", "v2"]}}', '$."k1.key".k2[0]') |
|
||||
+-----------------------------------------------------------------------+
|
||||
| v1 |
|
||||
+-----------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
4. Get all the values in the array where the key is "k1"
|
||||
```
|
||||
mysql> SELECT get_json_string('[{"k1":"v1"}, {"k2":"v2"}, {"k1":"v3"}, {"k1":"v4"}]', '$.k1');
|
||||
+---------------------------------------------------------------------------------+
|
||||
| get_json_string('[{"k1":"v1"}, {"k2":"v2"}, {"k1":"v3"}, {"k1":"v4"}]', '$.k1') |
|
||||
+---------------------------------------------------------------------------------+
|
||||
| ["v1","v3","v4"] |
|
||||
+---------------------------------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
GET_JSON_STRING,GET,JSON,STRING
|
||||
@ -0,0 +1,63 @@
|
||||
---
|
||||
{
|
||||
"title": "group_concat",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# group_concat
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`VARCHAR group_concat(VARCHAR str[, VARCHAR sep])`
|
||||
|
||||
|
||||
This function is an aggregation function similar to sum (), and group_concat links multiple rows of results in the result set to a string. The second parameter, sep, is a connection symbol between strings, which can be omitted. This function usually needs to be used with group by statements.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select value from test;
|
||||
+-------+
|
||||
| value |
|
||||
+-------+
|
||||
| a |
|
||||
| b |
|
||||
| c |
|
||||
+-------+
|
||||
|
||||
mysql> select group_concat(value) from test;
|
||||
+-----------------------+
|
||||
| group_concat(`value`) |
|
||||
+-----------------------+
|
||||
| a, b, c |
|
||||
+-----------------------+
|
||||
|
||||
mysql> select group_concat(value, " ") from test;
|
||||
+----------------------------+
|
||||
| group_concat(`value`, ' ') |
|
||||
+----------------------------+
|
||||
| a b c |
|
||||
+----------------------------+
|
||||
```
|
||||
##keyword
|
||||
GROUP_CONCAT,GROUP,CONCAT
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "instr",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# instr
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT INSR (WARCHAR STR, WARCHAR substrate)'
|
||||
|
||||
|
||||
Returns the location where substr first appeared in str (counting from 1). If substr does not appear in str, return 0.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select instr("abc", "b");
|
||||
+-------------------+
|
||||
| instr('abc', 'b') |
|
||||
+-------------------+
|
||||
| 2 |
|
||||
+-------------------+
|
||||
|
||||
mysql> select instr("abc", "d");
|
||||
+-------------------+
|
||||
| instr('abc', 'd') |
|
||||
+-------------------+
|
||||
| 0 |
|
||||
+-------------------+
|
||||
```
|
||||
##keyword
|
||||
INSTR
|
||||
@ -0,0 +1,37 @@
|
||||
---
|
||||
{
|
||||
"title": "lcase",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# lcase
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT lcase (VARCHAR str)`
|
||||
|
||||
|
||||
Consistent with `lower`.
|
||||
|
||||
##keyword
|
||||
LCASE
|
||||
47
docs/en/sql-reference/sql-functions/string-functions/left.md
Normal file
47
docs/en/sql-reference/sql-functions/string-functions/left.md
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
{
|
||||
"title": "left",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# left
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR left (VARCHAR str)'
|
||||
|
||||
|
||||
It returns the left part of a string of specified length
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select left("Hello doris",5);
|
||||
+------------------------+
|
||||
| left('Hello doris', 5) |
|
||||
+------------------------+
|
||||
| Hello |
|
||||
+------------------------+
|
||||
```
|
||||
##keyword
|
||||
LEFT
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "length",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# length
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT length (VARCHAR str)'
|
||||
|
||||
|
||||
Returns the length of the string and the number of characters returned for multi-byte characters. For example, five two-byte width words return a length of 10.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select length("abc");
|
||||
+---------------+
|
||||
| length('abc') |
|
||||
+---------------+
|
||||
| 3 |
|
||||
+---------------+
|
||||
|
||||
mysql> select length("中国");
|
||||
+------------------+
|
||||
| length('中国') |
|
||||
+------------------+
|
||||
| 6 |
|
||||
+------------------+
|
||||
```
|
||||
##keyword
|
||||
LENGTH
|
||||
@ -0,0 +1,61 @@
|
||||
---
|
||||
{
|
||||
"title": "locate",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# locate
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT LOCATION (WARCHAR substrate, WARCHAR str [, INT pos]]'
|
||||
|
||||
|
||||
Returns where substr appears in str (counting from 1). If the third parameter POS is specified, the position where substr appears is found from the string where STR starts with POS subscript. If not found, return 0
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT LOCATE('bar', 'foobarbar');
|
||||
+----------------------------+
|
||||
| locate('bar', 'foobarbar') |
|
||||
+----------------------------+
|
||||
| 4 |
|
||||
+----------------------------+
|
||||
|
||||
mysql> SELECT LOCATE('xbar', 'foobar');
|
||||
+--------------------------+
|
||||
| locate('xbar', 'foobar') |
|
||||
+--------------------------+
|
||||
| 0 |
|
||||
+--------------------------+
|
||||
|
||||
mysql> SELECT LOCATE('bar', 'foobarbar', 5);
|
||||
+-------------------------------+
|
||||
| locate('bar', 'foobarbar', 5) |
|
||||
+-------------------------------+
|
||||
| 7 |
|
||||
+-------------------------------+
|
||||
```
|
||||
##keyword
|
||||
LOCATE
|
||||
@ -0,0 +1,47 @@
|
||||
---
|
||||
{
|
||||
"title": "lower",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# lower
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT lower (WARCHAR str)'
|
||||
|
||||
|
||||
Convert all strings in parameters to lowercase
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT lower("AbC123");
|
||||
+-----------------+
|
||||
| lower('AbC123') |
|
||||
+-----------------+
|
||||
| abc123 |
|
||||
+-----------------+
|
||||
```
|
||||
##keyword
|
||||
LOWER
|
||||
54
docs/en/sql-reference/sql-functions/string-functions/lpad.md
Normal file
54
docs/en/sql-reference/sql-functions/string-functions/lpad.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "lpad",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# lpad
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR lpad (VARCHAR str., INT len, VARCHAR pad)'
|
||||
|
||||
|
||||
Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT lpad("hi", 5, "xy");
|
||||
+---------------------+
|
||||
| lpad('hi', 5, 'xy') |
|
||||
+---------------------+
|
||||
| xyxhi |
|
||||
+---------------------+
|
||||
|
||||
mysql> SELECT lpad("hi", 1, "xy");
|
||||
+---------------------+
|
||||
| lpad('hi', 1, 'xy') |
|
||||
+---------------------+
|
||||
| h |
|
||||
+---------------------+
|
||||
```
|
||||
##keyword
|
||||
LPAD
|
||||
@ -0,0 +1,47 @@
|
||||
---
|
||||
{
|
||||
"title": "ltrim",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# ltrim
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR ltrim (VARCHAR str)'
|
||||
|
||||
|
||||
Remove the space that appears continuously from the beginning of the parameter str
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ltrim(' ab d');
|
||||
+------------------+
|
||||
| ltrim(' ab d') |
|
||||
+------------------+
|
||||
| ab d |
|
||||
+------------------+
|
||||
```
|
||||
##keyword
|
||||
LTRIM
|
||||
@ -0,0 +1,61 @@
|
||||
---
|
||||
{
|
||||
"title": "money_format",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# money_format
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
VARCHAR money format (Number)
|
||||
|
||||
|
||||
The number is output in currency format, the integer part is separated by commas every three bits, and the decimal part is reserved for two bits.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select money_format(17014116);
|
||||
+------------------------+
|
||||
| money_format(17014116) |
|
||||
+------------------------+
|
||||
| 17,014,116.00 |
|
||||
+------------------------+
|
||||
|
||||
mysql> select money_format(1123.456);
|
||||
+------------------------+
|
||||
| money_format(1123.456) |
|
||||
+------------------------+
|
||||
| 1,123.46 |
|
||||
+------------------------+
|
||||
|
||||
mysql> select money_format(1123.4);
|
||||
+----------------------+
|
||||
| money_format(1123.4) |
|
||||
+----------------------+
|
||||
| 1,123.40 |
|
||||
+----------------------+
|
||||
```
|
||||
##keyword
|
||||
MONEY_FORMAT,MONEY,FORMAT
|
||||
@ -0,0 +1,60 @@
|
||||
---
|
||||
{
|
||||
"title": "null_or_empty",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# null_or_empty
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`BOOLEAN NULL_OR_EMPTY (VARCHAR str)`
|
||||
|
||||
It returns true if the string is an empty string or NULL. Otherwise it returns false.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
MySQL [(none)]> select null_or_empty(null);
|
||||
+---------------------+
|
||||
| null_or_empty(NULL) |
|
||||
+---------------------+
|
||||
| 1 |
|
||||
+---------------------+
|
||||
|
||||
MySQL [(none)]> select null_or_empty("");
|
||||
+-------------------+
|
||||
| null_or_empty('') |
|
||||
+-------------------+
|
||||
| 1 |
|
||||
+-------------------+
|
||||
|
||||
MySQL [(none)]> select null_or_empty("a");
|
||||
+--------------------+
|
||||
| null_or_empty('a') |
|
||||
+--------------------+
|
||||
| 0 |
|
||||
+--------------------+
|
||||
```
|
||||
##keyword
|
||||
NULL_OR_EMPTY
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "regexp_extract",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# regexp_extract
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR regexp 'extract (VARCHAR str, VARCHAR pattern, int pos)
|
||||
|
||||
|
||||
The string STR is matched regularly and the POS matching part which conforms to pattern is extracted. Patterns need to match exactly some part of the STR to return to the matching part of the pattern. If there is no match, return an empty string.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT regexp_extract('AbCdE', '([[:lower:]]+)C([[:lower:]]+)', 1);
|
||||
+-------------------------------------------------------------+
|
||||
| regexp_extract('AbCdE', '([[:lower:]]+)C([[:lower:]]+)', 1) |
|
||||
+-------------------------------------------------------------+
|
||||
| b |
|
||||
+-------------------------------------------------------------+
|
||||
|
||||
mysql> SELECT regexp_extract('AbCdE', '([[:lower:]]+)C([[:lower:]]+)', 2);
|
||||
+-------------------------------------------------------------+
|
||||
| regexp_extract('AbCdE', '([[:lower:]]+)C([[:lower:]]+)', 2) |
|
||||
+-------------------------------------------------------------+
|
||||
| d |
|
||||
+-------------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
REGEXP_EXTRACT,REGEXP,EXTRACT
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "regexp_replace",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# regexp_replace
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`VARCHAR regexp_replace(VARCHAR str, VARCHAR pattern, VARCHAR repl)
|
||||
|
||||
|
||||
Regular matching of STR strings, replacing the part hitting pattern with repl
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT regexp_replace('a b c', " ", "-");
|
||||
+-----------------------------------+
|
||||
| regexp_replace('a b c', ' ', '-') |
|
||||
+-----------------------------------+
|
||||
| a-b-c |
|
||||
+-----------------------------------+
|
||||
|
||||
mysql> SELECT regexp_replace('a b c','(b)','<\\1>');
|
||||
+----------------------------------------+
|
||||
| regexp_replace('a b c', '(b)', '<\1>') |
|
||||
+----------------------------------------+
|
||||
| a <b> c |
|
||||
+----------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
REGEXP_REPLACE,REGEXP,REPLACE
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "repeat",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# repeat
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR repeat (VARCHAR str, INT count)
|
||||
|
||||
|
||||
Repeat the str of the string count times, return empty string when count is less than 1, return NULL when str, count is any NULL
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT repeat("a", 3);
|
||||
+----------------+
|
||||
| repeat('a', 3) |
|
||||
+----------------+
|
||||
| aaa |
|
||||
+----------------+
|
||||
|
||||
mysql> SELECT repeat("a", -1);
|
||||
+-----------------+
|
||||
| repeat('a', -1) |
|
||||
+-----------------+
|
||||
| |
|
||||
+-----------------+
|
||||
```
|
||||
##keyword
|
||||
REPEAT,
|
||||
@ -0,0 +1,47 @@
|
||||
---
|
||||
{
|
||||
"title": "right",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# right
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR RIGHT (VARCHAR STR)'
|
||||
|
||||
|
||||
It returns the right part of a string of specified length
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select right("Hello doris",5);
|
||||
+-------------------------+
|
||||
| right('Hello doris', 5) |
|
||||
+-------------------------+
|
||||
| doris |
|
||||
+-------------------------+
|
||||
```
|
||||
##keyword
|
||||
RIGHT
|
||||
@ -0,0 +1,69 @@
|
||||
---
|
||||
{
|
||||
"title": "split_part",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# split_part
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR split party (VARCHAR content, VARCHAR delimiter, INT field)'
|
||||
|
||||
|
||||
Returns the specified partition (counting from the beginning) by splitting the string according to the partitioner.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select split_part("hello world", " ", 1);
|
||||
+----------------------------------+
|
||||
| split_part('hello world', ' ', 1) |
|
||||
+----------------------------------+
|
||||
| hello |
|
||||
+----------------------------------+
|
||||
|
||||
|
||||
mysql> select split_part("hello world", " ", 2);
|
||||
+----------------------------------+
|
||||
| split_part('hello world', ' ', 2) |
|
||||
+----------------------------------+
|
||||
| world |
|
||||
+----------------------------------+
|
||||
|
||||
mysql> select split_part("2019年7月8号", "月", 1);
|
||||
+-----------------------------------------+
|
||||
| split_part('2019年7月8号', '月', 1) |
|
||||
+-----------------------------------------+
|
||||
| 2019年7 |
|
||||
+-----------------------------------------+
|
||||
|
||||
mysql> select split_part("abca", "a", 1);
|
||||
+----------------------------+
|
||||
| split_part('abca', 'a', 1) |
|
||||
+----------------------------+
|
||||
| |
|
||||
+----------------------------+
|
||||
```
|
||||
##keyword
|
||||
SPLIT_PART,SPLIT,PART
|
||||
@ -0,0 +1,54 @@
|
||||
---
|
||||
{
|
||||
"title": "starts_with",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# starts_with
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`BOOLEAN STARTS_WITH (VARCHAR str, VARCHAR prefix)`
|
||||
|
||||
It returns true if the string starts with the specified prefix, otherwise it returns false.
|
||||
If any parameter is NULL, it returns NULL.
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
MySQL [(none)]> select starts_with("hello world","hello");
|
||||
+-------------------------------------+
|
||||
| starts_with('hello world', 'hello') |
|
||||
+-------------------------------------+
|
||||
| 1 |
|
||||
+-------------------------------------+
|
||||
|
||||
MySQL [(none)]> select starts_with("hello world","world");
|
||||
+-------------------------------------+
|
||||
| starts_with('hello world', 'world') |
|
||||
+-------------------------------------+
|
||||
| 0 |
|
||||
+-------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
STARTS_WITH
|
||||
@ -0,0 +1,47 @@
|
||||
---
|
||||
{
|
||||
"title": "strleft",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# strleft
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR STRAIGHT (VARCHAR STR)'
|
||||
|
||||
|
||||
It returns the left part of a string of specified length
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select strleft("Hello doris",5);
|
||||
+------------------------+
|
||||
| strleft('Hello doris', 5) |
|
||||
+------------------------+
|
||||
| Hello |
|
||||
+------------------------+
|
||||
```
|
||||
##keyword
|
||||
STRLEFT
|
||||
@ -0,0 +1,48 @@
|
||||
---
|
||||
{
|
||||
"title": "strright",
|
||||
"language": "en"
|
||||
}
|
||||
---
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
|
||||
# strright
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR strright (VARCHAR str)'
|
||||
|
||||
|
||||
It returns the right part of a string of specified length
|
||||
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select strright("Hello doris",5);
|
||||
+-------------------------+
|
||||
| strright('Hello doris', 5) |
|
||||
+-------------------------+
|
||||
| doris |
|
||||
+-------------------------+
|
||||
```
|
||||
##keyword
|
||||
STRRIGHT
|
||||
Reference in New Issue
Block a user