[Docs] Add like, regexp function documents (#6182)

* [Docs] Add like, regexp function documents

* Reconstruct

* Fix compile error
This commit is contained in:
EmmyMiao87
2021-07-15 13:16:21 +08:00
committed by GitHub
parent 409cee0fdb
commit 15c5896f41
16 changed files with 534 additions and 11 deletions

View File

@ -32,8 +32,8 @@ under the License.
`VARCHAR append_trailing_char_if_absent(VARCHAR str, VARCHAR trailing_char)`
If the s string is non-empty and does not contain the c character at the end, it appends the c character to the end.
Trailing_char contains only one character, and it will return NULL if contains more than one character
If the @str string is non-empty and does not contain the @trailing_char character at the end, it appends the @trailing_char character to the end.
@trailing_char contains only one character, and it will return NULL if contains more than one character
## example

View File

@ -0,0 +1,67 @@
---
{
"title": "like",
"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.
-->
# like
## description
### syntax
'BOOLEAN like(VARCHAR str, VARCHAR pattern)'
Perform fuzzy matching on the string str, return true if it matches, and false if it doesn't match.
like match/fuzzy match, will be used in combination with % and _.
'a' // Precise matching, the same effect as `=`.
'%a' // data ending with a
'a%' // data starting with a
'%a%' // data containing a
'_a_' // Three digits and the middle letter is a
'_a' // Two digits and the ending letter is a
'a_' // Two digits and the initial letter is a
## example
```
// Return the data containing a in the k1 string
mysql> select k1 from test where k1 like '%a%';
+-------+
| k1 |
+-------+
| a |
| bab |
+-------+
// Return the data equal to a in the k1 string
mysql> select k1 from test where k1 like 'a';
+-------+
| k1 |
+-------+
| a |
+-------+
```
## keyword
LIKE

View File

@ -0,0 +1,68 @@
---
{
"title": "not like",
"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.
-->
# not like
## description
### syntax
'BOOLEAN not like(VARCHAR str, VARCHAR pattern)'
Perform fuzzy matching on the string str, return false if it matches, and return true if it doesn't match.
like match/fuzzy match, will be used in combination with % and _.
'a' // Precise matching, the same effect as `=`.
'%a' // data ending with a
'a%' // data starting with a
'%a%' // data containing a
'_a_' // Three digits and the middle letter is a
'_a' // Two digits and the ending letter is a
'a_' // Two digits and the initial letter is a
## example
```
// Return data that does not contain a in the k1 string
mysql> select k1 from test where k1 not like '%a%';
+-------+
| k1 |
+-------+
| b |
| bb |
+-------+
// Return the data that is not equal to a in the k1 string
mysql> select k1 from test where k1 not like 'a';
+-------+
| k1 |
+-------+
| bab |
| b |
+-------+
```
## keyword
LIKE, NOT, NOT LIKE

View File

@ -0,0 +1,56 @@
---
{
"title": "not regexp",
"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.
-->
# not regexp
## description
### syntax
'BOOLEAN not regexp(VARCHAR str, VARCHAR pattern)'
Perform regular matching on the string str, return false if it matches, and return true if it doesn't match. pattern is a regular expression.
## example
```
// Find all data in the k1 field that does not start with 'billie'
mysql> select k1 from test where k1 not regexp '^billie';
+--------------------+
| k1 |
+--------------------+
| Emmy eillish |
+--------------------+
// Find all the data in the k1 field that does not end with 'ok':
mysql> select k1 from test where k1 not regexp 'ok$';
+------------+
| k1 |
+------------+
| It's true |
+------------+
```
## keyword
REGEXP, NOT, NOT REGEXP

View File

@ -0,0 +1,56 @@
---
{
"title": "regexp",
"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
## description
### syntax
'BOOLEAN regexp(VARCHAR str, VARCHAR pattern)'
Perform regular matching on the string str, return true if it matches, and return false if it doesn't match. pattern is a regular expression.
## example
```
// Find all data starting with 'billie' in the k1 field
mysql> select k1 from test where k1 regexp '^billie';
+--------------------+
| k1 |
+--------------------+
| billie eillish |
+--------------------+
// Find all data ending with 'ok' in the k1 field:
mysql> select k1 from test where k1 regexp 'ok$';
+----------+
| k1 |
+----------+
| It's ok |
+----------+
```
## keyword
REGEXP