This is an automated email from the ASF dual-hosted git repository.
kassiez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new e7478b81f89 fix conditional functions (#1970)
e7478b81f89 is described below
commit e7478b81f896cb8f9367d36a62f59f64a71c4654
Author: echo-dundun <[email protected]>
AuthorDate: Fri Feb 7 20:21:56 2025 +0800
fix conditional functions (#1970)
## Versions
- [x] dev
- [ ] 3.0
- [x] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../conditional-functions/coalesce.md | 32 ++++++----
.../conditional-functions/greatest.md | 68 ++++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 36 ++++++++----
.../conditional-functions/ifnull.md | 49 +++++++++++-----
.../conditional-functions/least.md | 67 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 55 +++++++++++------
.../conditional-functions/coalesce.md | 30 +++++++---
.../conditional-functions/greatest.md | 66 +++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 27 ++++++---
.../conditional-functions/ifnull.md | 45 ++++++++++----
.../conditional-functions/least.md | 65 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 51 +++++++++++-----
.../scalar-functions/numeric-functions/sqrt.md | 2 +-
.../conditional-functions/coalesce.md | 30 +++++++---
.../sql-functions/conditional-functions/if.md | 27 ++++++---
.../sql-functions/conditional-functions/ifnull.md | 45 ++++++++++----
.../sql-functions/conditional-functions/nullif.md | 51 +++++++++++-----
.../sql-functions/numeric-functions/greatest.md | 66 +++++++++++++++------
.../sql-functions/numeric-functions/least.md | 65 +++++++++++++++------
.../string-functions/not-null-or-empty.md | 41 ++++++++++---
.../string-functions/null-or-empty.md | 43 ++++++++++----
.../conditional-functions/coalesce.md | 30 +++++++---
.../conditional-functions/greatest.md | 66 +++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 27 ++++++---
.../conditional-functions/ifnull.md | 45 ++++++++++----
.../conditional-functions/least.md | 65 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 51 +++++++++++-----
.../scalar-functions/numeric-functions/sqrt.md | 2 +-
.../conditional-functions/coalesce.md | 30 +++++++---
.../conditional-functions/greatest.md | 66 +++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 27 ++++++---
.../conditional-functions/ifnull.md | 45 ++++++++++----
.../conditional-functions/least.md | 65 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 51 +++++++++++-----
.../scalar-functions/numeric-functions/sqrt.md | 2 +-
tools/a | 0
.../conditional-functions/coalesce.md | 32 ++++++----
.../sql-functions/conditional-functions/if.md | 36 ++++++++----
.../sql-functions/conditional-functions/ifnull.md | 49 +++++++++++-----
.../sql-functions/conditional-functions/nullif.md | 55 +++++++++++------
.../sql-functions/numeric-functions/greatest.md | 68 ++++++++++++++++------
.../sql-functions/numeric-functions/least.md | 67 +++++++++++++++------
.../string-functions/not-null-or-empty.md | 47 +++++++++++----
.../string-functions/null-or-empty.md | 47 +++++++++++----
.../conditional-functions/coalesce.md | 32 ++++++----
.../conditional-functions/greatest.md | 68 ++++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 36 ++++++++----
.../conditional-functions/ifnull.md | 49 +++++++++++-----
.../conditional-functions/least.md | 67 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 55 +++++++++++------
.../conditional-functions/coalesce.md | 32 ++++++----
.../conditional-functions/greatest.md | 68 ++++++++++++++++------
.../scalar-functions/conditional-functions/if.md | 36 ++++++++----
.../conditional-functions/ifnull.md | 49 +++++++++++-----
.../conditional-functions/least.md | 67 +++++++++++++++------
.../conditional-functions/not-null-or-empty.md | 10 ++--
.../conditional-functions/null-or-empty.md | 8 +--
.../conditional-functions/nullif.md | 55 +++++++++++------
68 files changed, 1872 insertions(+), 784 deletions(-)
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 871c71d3b56..b8abdf5429f 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
-### description
-#### Syntax
+## Description
-`coalesce(expr1, expr2, ...., expr_n)`
+Returns the first non-null expression from left to right in the parameter
list. If all arguments are NULL, returns NULL.
+## Syntax
-Returns the first non empty expression in the parameter (from left to right)
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## Parameters
+
+| Parameter | Description
|
+| -------------- |
----------------------------------------------------------------------------- |
+| `<expr>` | A sequence of expressions to evaluate. All expressions must be
compatible data types. |
+
+## Return Value
-### example
+The first non-null expression in the parameter list. Returns NULL if all
arguments are NULL.
+## Examples
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-COALESCE
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index 279e7d80002..3d637696525 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
+## Description
+
+Compares multiple expressions and returns the greatest value among them. If
any argument is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+GREATEST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`greatest(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | A list of expressions to compare. Supports `TINYINT`,
`SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`, `STRING`,
`DATETIME`, and `DECIMAL` types. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compares the size of `n columns` and returns the largest among them. If there
is `NULL` in `column`, it returns `NULL`.
+- Returns the largest value among the given expressions.
+- If any argument is `NULL`, returns `NULL`.
-### example
+## Examples
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 4c23b08a58f..441103204f5 100644
--- a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++ b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,41 @@ specific language governing permissions and limitations
under the License.
-->
-## if
-### description
-#### Syntax
+## Description
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+Returns `valueTrue` when the condition is true, and returns `valueFalseOrNull`
otherwise. The return type is determined by the result of the
`valueTrue`/`valueFalseOrNull` expression.
+## Syntax
-Returns valueTrue when condition is true, returns valueFalseOrNull otherwise.
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+|-------------------------|--------------------------------------------------------------|
+| `<condition>` | The boolean condition to evaluate.
|
+| `<value_true>` | The value to return if `<condition>` evaluates to
true. |
+| `<value_false_or_null>` | The value to return if `<condition>` evaluates to
false. |
-The return type is the type of the result of the valueTrue/valueFalseOrNull
expression
+## Return Value
-### example
+The result of the IF expression:
+- Returns `valueTrue` when the condition is true.
+- Returns `valueFalseOrNull` when the condition is false.
+## Examples
+
+```sql
+SELECT user_id, IF(user_id = 1, 'true', 'false') AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 5b5493fcd00..86c463388dd 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
-### description
-#### Syntax
+## Description
-`ifnull(expr1, expr2)`
+Returns `<expr1>` if it is not `NULL`; otherwise, returns `<expr2>`.
+## Alias
-If the value of expr1 is not null, expr1 is returned, otherwise expr2 is
returned
+- NVL
-### example
+## Syntax
+```sql
+IFNULL(<expr1>, <expr2>)
```
-mysql> select ifnull(1,0);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first expression to check for `NULL`. |
+| `<expr2>` | The value to return if `<expr1>` is `NULL`. |
+
+## Return Value
+
+- Returns `<expr1>` if it is not `NULL`.
+- Otherwise, returns `<expr2>`.
+
+## Examples
+
+```sql
+SELECT IFNULL(1, 0);
+```
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 7835d259c2b..316dbb0f77b 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
+## Description
+
+Compares multiple expressions and returns the smallest value among them. If
any parameter is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+LEAST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`least(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | The expressions to be compared. Supported types include
`TINYINT`, `SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`,
`STRING`, `DATETIME`, and `DECIMAL`. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compare the size of `n columns` and return the smallest among them. If there
is `NULL` in `column`, return `NULL`.
+- Returns the smallest value among the given expressions.
+- If any parameter is `NULL`, the function returns `NULL`.
-### example
+## Examples
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index bfa440eb9cf..063ae762c3f 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -36,9 +36,9 @@ NOT_NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ------------------- |
+| `<str>` | The string to check |
## Return Value
@@ -46,11 +46,11 @@ Returns false if the string is an empty string or NULL,
otherwise returns true.
## Examples
-```
+```sql
select not_null_or_empty(null);
```
-```
+```text
+-------------------------+
| not_null_or_empty(NULL) |
+-------------------------+
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 8e69730d9c0..f0c5ec53e2d 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,9 +36,9 @@ NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ---------------------- |
+| `<str>` | The string to check. |
## Return Value
@@ -80,4 +80,4 @@ select null_or_empty("a");
+--------------------+
| 0 |
+--------------------+
-```
+```
\ No newline at end of file
diff --git
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 07a99354678..2348e227d5e 100644
---
a/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/docs/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
-### description
-#### Syntax
+## Description
-`nullif(expr1, expr2)`
+Returns `NULL` if the two input values are equal; otherwise, returns the first
input value. This function is equivalent to the following `CASE WHEN`
expression:
-
-If the two parameters are equal, null is returned. Otherwise, the value of the
first parameter is returned. It has the same effect as the following `case when`
-
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
-### example
+## Syntax
+```sql
+NULLIF(<expr1>, <expr2>)
```
-mysql> select nullif(1,1);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first input value to compare. |
+| `<expr2>` | The second input value to compare against the first. |
+
+## Return Value
+
+- Returns `NULL` if `<expr1>` is equal to `<expr2>`.
+- Otherwise, returns the value of `<expr1>`.
+
+## Examples
+
+```sql
+SELECT NULLIF(1, 1);
+```
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
-mysql> select nullif(1,0);
+```sql
+SELECT NULLIF(1, 0);
+```
+
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 5467205a804..b79055a130a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
## 描述
+
+返回参数列表中从左到右第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+
## 语法
-`coalesce(expr1, expr2, ...., expr_n))`
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------- | ------------------------------------------------------------
|
+| `<expr>` | 需要逐个检查的表达式序列,所有表达式必须具有兼容的数据类型。 |
-返回参数中的第一个非空表达式(从左向右)
+## 返回值
-## 举例
+参数列表中第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+## 示例
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-
- COALESCE
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index d3a18c54b10..780fdc6e070 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
-
## 描述
+
+比较多个表达式的大小,并返回其中的最大值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`greatest(col_a, col_b, …, col_n)`
+```sql
+GREATEST(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要比较的多个表达式,支持
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL` 类型。 |
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+## 返回值
-比较`n`个`column`的大小返回其中的最大值.若`column`中有`NULL`,则返回`NULL`.
+- 返回给定表达式中的最大值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
-## 举例
+## 示例
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 46269134c67..e8f08cf3105 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## if
## 描述
-## 语法
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+如果表达式 `<condition>` 成立,则返回 `<value_true>`;否则返回 `<value_false_or_null>`。
+返回类型:`<value_true>` 表达式的结果类型。
+
+## 语法
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
-如果表达式 condition 成立,返回结果 valueTrue;否则,返回结果 valueFalseOrNull
-返回类型: valueTrue 表达式结果的类型
+## 参数
+| 参数 | 说明 |
+|-------------------------|----------------------------------|
+| `<condition>` | 用于判断的布尔表达式。 |
+| `<value_true>` | 当 `<condition>` 为真时返回的值。 |
+| `<value_false_or_null>` | 当 `<condition>` 为假时返回的值。 |
## 举例
+```sql
+SELECT user_id, IF(user_id = 1, "true", "false") AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 74954c257b6..173673a37ad 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -6,7 +6,7 @@
---
<!--
-Licensed to the Apache Software Foundation (ASF) under one
+Licensed to the Apache Software Foundation (ASF) under一
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
## 描述
+
+如果 `<expr1>` 的值不为 `NULL`,则返回 `<expr1>`;否则返回 `<expr2>`。
+
+## 别名
+
+- NVL
+
## 语法
-`ifnull(expr1, expr2)`
+```sql
+IFNULL(<expr1>, <expr2>)
+```
+
+## 参数
+| 参数 | 描述 |
+|------------|------|
+| `<expr1>` | 需要判断是否为 `NULL` 的表达式。 |
+| `<expr2>` | `<expr1>` 为 `NULL` 时返回的值。 |
-如果 expr1 的值不为 NULL 则返回 expr1,否则返回 expr2
+## 返回值
+
+- 如果 `<expr1>` 不为 `NULL`,则返回 `<expr1>`。
+- 否则,返回 `<expr2>`。
## 举例
+```sql
+SELECT IFNULL(1, 0);
```
-mysql> select ifnull(1,0);
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 14f2f63c9d6..90c10107ed0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
-
## 描述
+
+比较多个表达式的大小,返回其中的最小值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`least(col_a, col_b, …, col_n)`
+```sql
+LEAST(<expr> [, ...])
+```
+
+## 参数
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要进行比较的表达式。支持的类型包括
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL`。 |
-比较`n`个`column`的大小返回其中的最小值.若`column`中有`NULL`,则返回`NULL`.
+## 返回值
-## 举例
+- 返回多个输入表达式中的最小值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
+## 示例
+
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index 50c26f3cd63..1f3c632ad9f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -26,7 +26,7 @@ under the License.
## 描述
-`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true,否则返回
false。
+`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true;否则返回
false。
## 语法
@@ -36,13 +36,13 @@ NOT_NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回false。否则,返回true。
+如果字符串为空字符串或者 NULL,返回 false;否则返回 true。
## 举例
@@ -70,7 +70,7 @@ select not_null_or_empty("");
+-----------------------+
```
-```
+```sql
select not_null_or_empty("a");
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 61fdf3e8a5d..a43fefcb74c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,15 +36,15 @@ NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回true。否则,返回false。
+如果字符串为空字符串或者 NULL,返回 true;否则返回 false。
-## 举例
+## 示例
```sql
select null_or_empty(null);
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 1f9d7c98945..b44b4a43b43 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
## 描述
-## 语法
-
-`nullif(expr1, expr2)`
-
-如果两个参数相等,则返回NULL。否则返回第一个参数的值。它和以下的 `CASE WHEN` 效果一样
+如果两个输入值相等,则返回 `NULL`;否则返回第一个输入值。该函数等价于以下 `CASE WHEN` 表达式:
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
+## 语法
+
+```sql
+NULLIF(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+|-----------|-------------|
+| `<expr1>` | 需要进行比较的第一个输入值。 |
+| `<expr2>` | 需要与第一个输入值进行比较的第二个值。 |
+
+## 返回值
+
+- 如果 `<expr1>` 等于 `<expr2>`,则返回 `NULL`。
+- 否则,返回 `<expr1>` 的值。
+
## 举例
+```sql
+SELECT NULLIF(1, 1);
```
-mysql> select nullif(1,1);
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
+
+```sql
+SELECT NULLIF(1, 0);
+```
-mysql> select nullif(1,0);
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
index 780cbdc33be..49aabcb51f3 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
@@ -30,7 +30,7 @@ under the License.
## 别名
-- DSQRT
+- NVL
## 语法
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
index 5467205a804..b79055a130a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
## 描述
+
+返回参数列表中从左到右第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+
## 语法
-`coalesce(expr1, expr2, ...., expr_n))`
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------- | ------------------------------------------------------------
|
+| `<expr>` | 需要逐个检查的表达式序列,所有表达式必须具有兼容的数据类型。 |
-返回参数中的第一个非空表达式(从左向右)
+## 返回值
-## 举例
+参数列表中第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+## 示例
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-
- COALESCE
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
index 46269134c67..e8f08cf3105 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
@@ -24,27 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## if
## 描述
-## 语法
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+如果表达式 `<condition>` 成立,则返回 `<value_true>`;否则返回 `<value_false_or_null>`。
+返回类型:`<value_true>` 表达式的结果类型。
+
+## 语法
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
-如果表达式 condition 成立,返回结果 valueTrue;否则,返回结果 valueFalseOrNull
-返回类型: valueTrue 表达式结果的类型
+## 参数
+| 参数 | 说明 |
+|-------------------------|----------------------------------|
+| `<condition>` | 用于判断的布尔表达式。 |
+| `<value_true>` | 当 `<condition>` 为真时返回的值。 |
+| `<value_false_or_null>` | 当 `<condition>` 为假时返回的值。 |
## 举例
+```sql
+SELECT user_id, IF(user_id = 1, "true", "false") AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
index 74954c257b6..173673a37ad 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
@@ -6,7 +6,7 @@
---
<!--
-Licensed to the Apache Software Foundation (ASF) under one
+Licensed to the Apache Software Foundation (ASF) under一
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
## 描述
+
+如果 `<expr1>` 的值不为 `NULL`,则返回 `<expr1>`;否则返回 `<expr2>`。
+
+## 别名
+
+- NVL
+
## 语法
-`ifnull(expr1, expr2)`
+```sql
+IFNULL(<expr1>, <expr2>)
+```
+
+## 参数
+| 参数 | 描述 |
+|------------|------|
+| `<expr1>` | 需要判断是否为 `NULL` 的表达式。 |
+| `<expr2>` | `<expr1>` 为 `NULL` 时返回的值。 |
-如果 expr1 的值不为 NULL 则返回 expr1,否则返回 expr2
+## 返回值
+
+- 如果 `<expr1>` 不为 `NULL`,则返回 `<expr1>`。
+- 否则,返回 `<expr2>`。
## 举例
+```sql
+SELECT IFNULL(1, 0);
```
-mysql> select ifnull(1,0);
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
index 1f9d7c98945..b44b4a43b43 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
## 描述
-## 语法
-
-`nullif(expr1, expr2)`
-
-如果两个参数相等,则返回NULL。否则返回第一个参数的值。它和以下的 `CASE WHEN` 效果一样
+如果两个输入值相等,则返回 `NULL`;否则返回第一个输入值。该函数等价于以下 `CASE WHEN` 表达式:
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
+## 语法
+
+```sql
+NULLIF(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+|-----------|-------------|
+| `<expr1>` | 需要进行比较的第一个输入值。 |
+| `<expr2>` | 需要与第一个输入值进行比较的第二个值。 |
+
+## 返回值
+
+- 如果 `<expr1>` 等于 `<expr2>`,则返回 `NULL`。
+- 否则,返回 `<expr1>` 的值。
+
## 举例
+```sql
+SELECT NULLIF(1, 1);
```
-mysql> select nullif(1,1);
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
+
+```sql
+SELECT NULLIF(1, 0);
+```
-mysql> select nullif(1,0);
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
index d3a18c54b10..780fdc6e070 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
-
## 描述
+
+比较多个表达式的大小,并返回其中的最大值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`greatest(col_a, col_b, …, col_n)`
+```sql
+GREATEST(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要比较的多个表达式,支持
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL` 类型。 |
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+## 返回值
-比较`n`个`column`的大小返回其中的最大值.若`column`中有`NULL`,则返回`NULL`.
+- 返回给定表达式中的最大值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
-## 举例
+## 示例
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
index 14f2f63c9d6..90c10107ed0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
-
## 描述
+
+比较多个表达式的大小,返回其中的最小值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`least(col_a, col_b, …, col_n)`
+```sql
+LEAST(<expr> [, ...])
+```
+
+## 参数
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要进行比较的表达式。支持的类型包括
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL`。 |
-比较`n`个`column`的大小返回其中的最小值.若`column`中有`NULL`,则返回`NULL`.
+## 返回值
-## 举例
+- 返回多个输入表达式中的最小值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
+## 示例
+
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
index 72902081486..1f3c632ad9f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
@@ -24,37 +24,60 @@ specific language governing permissions and limitations
under the License.
-->
-## not_null_or_empty
## 描述
+
+`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true;否则返回
false。
+
## 语法
-`BOOLEAN NOT_NULL_OR_EMPTY (VARCHAR str)`
+```sql
+NOT_NULL_OR_EMPTY (<str>)
+```
+
+## 参数
-如果字符串为空字符串或者NULL,返回false。否则,返回true。
+| 参数 | 说明 |
+| ------- | ---------- |
+| `<str>` | 字符串类型 |
+
+## 返回值
+
+如果字符串为空字符串或者 NULL,返回 false;否则返回 true。
## 举例
+```sql
+select not_null_or_empty(null);
```
-MySQL [(none)]> select not_null_or_empty(null);
+
+```text
+-------------------------+
| not_null_or_empty(NULL) |
+-------------------------+
| 0 |
+-------------------------+
+```
+
+```sql
+select not_null_or_empty("");
+```
-MySQL [(none)]> select not_null_or_empty("");
+```text
+-----------------------+
| not_null_or_empty('') |
+-----------------------+
| 0 |
+-----------------------+
+```
-MySQL [(none)]> select not_null_or_empty("a");
+```sql
+select not_null_or_empty("a");
+```
+
+```text
+------------------------+
| not_null_or_empty('a') |
+------------------------+
| 1 |
+------------------------+
-```
-### keywords
- NOT_NULL_OR_EMPTY
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
index d98b63a7d2b..a43fefcb74c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
@@ -24,37 +24,60 @@ specific language governing permissions and limitations
under the License.
-->
-## null_or_empty
## 描述
+
+`null_or_empty` 函数用于判断给定的值是否为 NULL 或空。如果输入值为 NULL 或空字符串,则返回 true,否则返回 false。
+
## 语法
-`BOOLEAN NULL_OR_EMPTY (VARCHAR str)`
+```sql
+NULL_OR_EMPTY (<str>)
+```
+
+## 参数
-如果字符串为空字符串或者NULL,返回true。否则,返回false。
+| 参数 | 说明 |
+| ------- | ---------- |
+| `<str>` | 字符串类型 |
-## 举例
+## 返回值
+如果字符串为空字符串或者 NULL,返回 true;否则返回 false。
+
+## 示例
+
+```sql
+select null_or_empty(null);
```
-MySQL [(none)]> select null_or_empty(null);
+
+```text
+---------------------+
| null_or_empty(NULL) |
+---------------------+
| 1 |
+---------------------+
+```
+
+```sql
+select null_or_empty("");
+```
-MySQL [(none)]> select null_or_empty("");
+```text
+-------------------+
| null_or_empty('') |
+-------------------+
| 1 |
+-------------------+
+```
-MySQL [(none)]> select null_or_empty("a");
+```sql
+select null_or_empty("a");
+```
+
+```text
+--------------------+
| null_or_empty('a') |
+--------------------+
| 0 |
+--------------------+
-```
-### keywords
- NULL_OR_EMPTY
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 5467205a804..b79055a130a 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
## 描述
+
+返回参数列表中从左到右第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+
## 语法
-`coalesce(expr1, expr2, ...., expr_n))`
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------- | ------------------------------------------------------------
|
+| `<expr>` | 需要逐个检查的表达式序列,所有表达式必须具有兼容的数据类型。 |
-返回参数中的第一个非空表达式(从左向右)
+## 返回值
-## 举例
+参数列表中第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+## 示例
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-
- COALESCE
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index d3a18c54b10..3c6e129f304 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
-
## 描述
+
+比较多个表达式的大小,并返回其中的最大值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`greatest(col_a, col_b, …, col_n)`
+```sql
+GREATEST(<expr1>, <expr2>, ..., <exprN>)
+```
+
+## 参数
+
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要比较的多个表达式,支持
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL` 类型。 |
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+## 返回值
-比较`n`个`column`的大小返回其中的最大值.若`column`中有`NULL`,则返回`NULL`.
+- 返回给定表达式中的最大值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
-## 举例
+## 示例
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 46269134c67..e8f08cf3105 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## if
## 描述
-## 语法
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+如果表达式 `<condition>` 成立,则返回 `<value_true>`;否则返回 `<value_false_or_null>`。
+返回类型:`<value_true>` 表达式的结果类型。
+
+## 语法
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
-如果表达式 condition 成立,返回结果 valueTrue;否则,返回结果 valueFalseOrNull
-返回类型: valueTrue 表达式结果的类型
+## 参数
+| 参数 | 说明 |
+|-------------------------|----------------------------------|
+| `<condition>` | 用于判断的布尔表达式。 |
+| `<value_true>` | 当 `<condition>` 为真时返回的值。 |
+| `<value_false_or_null>` | 当 `<condition>` 为假时返回的值。 |
## 举例
+```sql
+SELECT user_id, IF(user_id = 1, "true", "false") AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 74954c257b6..173673a37ad 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -6,7 +6,7 @@
---
<!--
-Licensed to the Apache Software Foundation (ASF) under one
+Licensed to the Apache Software Foundation (ASF) under一
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
## 描述
+
+如果 `<expr1>` 的值不为 `NULL`,则返回 `<expr1>`;否则返回 `<expr2>`。
+
+## 别名
+
+- NVL
+
## 语法
-`ifnull(expr1, expr2)`
+```sql
+IFNULL(<expr1>, <expr2>)
+```
+
+## 参数
+| 参数 | 描述 |
+|------------|------|
+| `<expr1>` | 需要判断是否为 `NULL` 的表达式。 |
+| `<expr2>` | `<expr1>` 为 `NULL` 时返回的值。 |
-如果 expr1 的值不为 NULL 则返回 expr1,否则返回 expr2
+## 返回值
+
+- 如果 `<expr1>` 不为 `NULL`,则返回 `<expr1>`。
+- 否则,返回 `<expr2>`。
## 举例
+```sql
+SELECT IFNULL(1, 0);
```
-mysql> select ifnull(1,0);
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 14f2f63c9d6..90c10107ed0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
-
## 描述
+
+比较多个表达式的大小,返回其中的最小值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`least(col_a, col_b, …, col_n)`
+```sql
+LEAST(<expr> [, ...])
+```
+
+## 参数
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要进行比较的表达式。支持的类型包括
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL`。 |
-比较`n`个`column`的大小返回其中的最小值.若`column`中有`NULL`,则返回`NULL`.
+## 返回值
-## 举例
+- 返回多个输入表达式中的最小值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
+## 示例
+
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index 50c26f3cd63..1f3c632ad9f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -26,7 +26,7 @@ under the License.
## 描述
-`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true,否则返回
false。
+`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true;否则返回
false。
## 语法
@@ -36,13 +36,13 @@ NOT_NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回false。否则,返回true。
+如果字符串为空字符串或者 NULL,返回 false;否则返回 true。
## 举例
@@ -70,7 +70,7 @@ select not_null_or_empty("");
+-----------------------+
```
-```
+```sql
select not_null_or_empty("a");
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 61fdf3e8a5d..a43fefcb74c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,15 +36,15 @@ NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回true。否则,返回false。
+如果字符串为空字符串或者 NULL,返回 true;否则返回 false。
-## 举例
+## 示例
```sql
select null_or_empty(null);
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 1f9d7c98945..b44b4a43b43 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
## 描述
-## 语法
-
-`nullif(expr1, expr2)`
-
-如果两个参数相等,则返回NULL。否则返回第一个参数的值。它和以下的 `CASE WHEN` 效果一样
+如果两个输入值相等,则返回 `NULL`;否则返回第一个输入值。该函数等价于以下 `CASE WHEN` 表达式:
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
+## 语法
+
+```sql
+NULLIF(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+|-----------|-------------|
+| `<expr1>` | 需要进行比较的第一个输入值。 |
+| `<expr2>` | 需要与第一个输入值进行比较的第二个值。 |
+
+## 返回值
+
+- 如果 `<expr1>` 等于 `<expr2>`,则返回 `NULL`。
+- 否则,返回 `<expr1>` 的值。
+
## 举例
+```sql
+SELECT NULLIF(1, 1);
```
-mysql> select nullif(1,1);
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
+
+```sql
+SELECT NULLIF(1, 0);
+```
-mysql> select nullif(1,0);
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
index 780cbdc33be..49aabcb51f3 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
@@ -30,7 +30,7 @@ under the License.
## 别名
-- DSQRT
+- NVL
## 语法
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 5467205a804..621bf9f4aca 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
## 描述
+
+返回参数列表中从左到右第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+
## 语法
-`coalesce(expr1, expr2, ...., expr_n))`
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 说明 |
+| ------------- | ------------------------------------------------------------
|
+| `<expr>`| 需要逐个检查的表达式序列,所有表达式必须具有兼容的数据类型。 |
-返回参数中的第一个非空表达式(从左向右)
+## 返回值
-## 举例
+参数列表中第一个非空表达式。如果所有参数都为 NULL,则返回 NULL。
+## 示例
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-
- COALESCE
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index d3a18c54b10..780fdc6e070 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
-
## 描述
+
+比较多个表达式的大小,并返回其中的最大值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`greatest(col_a, col_b, …, col_n)`
+```sql
+GREATEST(<expr> [, ...])
+```
+
+## 参数
+
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要比较的多个表达式,支持
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL` 类型。 |
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+## 返回值
-比较`n`个`column`的大小返回其中的最大值.若`column`中有`NULL`,则返回`NULL`.
+- 返回给定表达式中的最大值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
-## 举例
+## 示例
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 46269134c67..e8f08cf3105 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## if
## 描述
-## 语法
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+如果表达式 `<condition>` 成立,则返回 `<value_true>`;否则返回 `<value_false_or_null>`。
+返回类型:`<value_true>` 表达式的结果类型。
+
+## 语法
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
-如果表达式 condition 成立,返回结果 valueTrue;否则,返回结果 valueFalseOrNull
-返回类型: valueTrue 表达式结果的类型
+## 参数
+| 参数 | 说明 |
+|-------------------------|----------------------------------|
+| `<condition>` | 用于判断的布尔表达式。 |
+| `<value_true>` | 当 `<condition>` 为真时返回的值。 |
+| `<value_false_or_null>` | 当 `<condition>` 为假时返回的值。 |
## 举例
+```sql
+SELECT user_id, IF(user_id = 1, "true", "false") AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 74954c257b6..173673a37ad 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -6,7 +6,7 @@
---
<!--
-Licensed to the Apache Software Foundation (ASF) under one
+Licensed to the Apache Software Foundation (ASF) under一
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
## 描述
+
+如果 `<expr1>` 的值不为 `NULL`,则返回 `<expr1>`;否则返回 `<expr2>`。
+
+## 别名
+
+- NVL
+
## 语法
-`ifnull(expr1, expr2)`
+```sql
+IFNULL(<expr1>, <expr2>)
+```
+
+## 参数
+| 参数 | 描述 |
+|------------|------|
+| `<expr1>` | 需要判断是否为 `NULL` 的表达式。 |
+| `<expr2>` | `<expr1>` 为 `NULL` 时返回的值。 |
-如果 expr1 的值不为 NULL 则返回 expr1,否则返回 expr2
+## 返回值
+
+- 如果 `<expr1>` 不为 `NULL`,则返回 `<expr1>`。
+- 否则,返回 `<expr2>`。
## 举例
+```sql
+SELECT IFNULL(1, 0);
```
-mysql> select ifnull(1,0);
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 14f2f63c9d6..90c10107ed0 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
-
## 描述
+
+比较多个表达式的大小,返回其中的最小值。如果任意参数为 `NULL`,则返回 `NULL`。
+
## 语法
-`least(col_a, col_b, …, col_n)`
+```sql
+LEAST(<expr> [, ...])
+```
+
+## 参数
-`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE`
`STRING` `DATETIME` `DECIMAL`
+| 参数 | 描述 |
+|------------|-------------|
+| `<expr>` | 需要进行比较的表达式。支持的类型包括
`TINYINT`、`SMALLINT`、`INT`、`BIGINT`、`LARGEINT`、`FLOAT`、`DOUBLE`、`STRING`、`DATETIME`
和 `DECIMAL`。 |
-比较`n`个`column`的大小返回其中的最小值.若`column`中有`NULL`,则返回`NULL`.
+## 返回值
-## 举例
+- 返回多个输入表达式中的最小值。
+- 如果任意参数为 `NULL`,则返回 `NULL`。
+## 示例
+
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index 50c26f3cd63..1f3c632ad9f 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -26,7 +26,7 @@ under the License.
## 描述
-`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true,否则返回
false。
+`not_null_or_empty` 函数用于判断给定的值是否为非 NULL 且非空。如果输入值不为 NULL 且不为空,则返回 true;否则返回
false。
## 语法
@@ -36,13 +36,13 @@ NOT_NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回false。否则,返回true。
+如果字符串为空字符串或者 NULL,返回 false;否则返回 true。
## 举例
@@ -70,7 +70,7 @@ select not_null_or_empty("");
+-----------------------+
```
-```
+```sql
select not_null_or_empty("a");
```
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 61fdf3e8a5d..a43fefcb74c 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,15 +36,15 @@ NULL_OR_EMPTY (<str>)
## 参数
-| 参数 | 说明 |
-| -- | -- |
+| 参数 | 说明 |
+| ------- | ---------- |
| `<str>` | 字符串类型 |
## 返回值
-如果字符串为空字符串或者NULL,返回true。否则,返回false。
+如果字符串为空字符串或者 NULL,返回 true;否则返回 false。
-## 举例
+## 示例
```sql
select null_or_empty(null);
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 1f9d7c98945..b44b4a43b43 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
## 描述
-## 语法
-
-`nullif(expr1, expr2)`
-
-如果两个参数相等,则返回NULL。否则返回第一个参数的值。它和以下的 `CASE WHEN` 效果一样
+如果两个输入值相等,则返回 `NULL`;否则返回第一个输入值。该函数等价于以下 `CASE WHEN` 表达式:
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
+## 语法
+
+```sql
+NULLIF(<expr1>, <expr2>)
+```
+
+## 参数
+
+| 参数 | 说明 |
+|-----------|-------------|
+| `<expr1>` | 需要进行比较的第一个输入值。 |
+| `<expr2>` | 需要与第一个输入值进行比较的第二个值。 |
+
+## 返回值
+
+- 如果 `<expr1>` 等于 `<expr2>`,则返回 `NULL`。
+- 否则,返回 `<expr1>` 的值。
+
## 举例
+```sql
+SELECT NULLIF(1, 1);
```
-mysql> select nullif(1,1);
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
+
+```sql
+SELECT NULLIF(1, 0);
+```
-mysql> select nullif(1,0);
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
index 780cbdc33be..49aabcb51f3 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/scalar-functions/numeric-functions/sqrt.md
@@ -30,7 +30,7 @@ under the License.
## 别名
-- DSQRT
+- NVL
## 语法
diff --git a/tools/a b/tools/a
new file mode 100644
index 00000000000..e69de29bb2d
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
index 871c71d3b56..b8abdf5429f 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
-### description
-#### Syntax
+## Description
-`coalesce(expr1, expr2, ...., expr_n)`
+Returns the first non-null expression from left to right in the parameter
list. If all arguments are NULL, returns NULL.
+## Syntax
-Returns the first non empty expression in the parameter (from left to right)
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## Parameters
+
+| Parameter | Description
|
+| -------------- |
----------------------------------------------------------------------------- |
+| `<expr>` | A sequence of expressions to evaluate. All expressions must be
compatible data types. |
+
+## Return Value
-### example
+The first non-null expression in the parameter list. Returns NULL if all
arguments are NULL.
+## Examples
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-COALESCE
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
index 4c23b08a58f..441103204f5 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/if.md
@@ -24,27 +24,41 @@ specific language governing permissions and limitations
under the License.
-->
-## if
-### description
-#### Syntax
+## Description
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+Returns `valueTrue` when the condition is true, and returns `valueFalseOrNull`
otherwise. The return type is determined by the result of the
`valueTrue`/`valueFalseOrNull` expression.
+## Syntax
-Returns valueTrue when condition is true, returns valueFalseOrNull otherwise.
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+|-------------------------|--------------------------------------------------------------|
+| `<condition>` | The boolean condition to evaluate.
|
+| `<value_true>` | The value to return if `<condition>` evaluates to
true. |
+| `<value_false_or_null>` | The value to return if `<condition>` evaluates to
false. |
-The return type is the type of the result of the valueTrue/valueFalseOrNull
expression
+## Return Value
-### example
+The result of the IF expression:
+- Returns `valueTrue` when the condition is true.
+- Returns `valueFalseOrNull` when the condition is false.
+## Examples
+
+```sql
+SELECT user_id, IF(user_id = 1, 'true', 'false') AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
index 5b5493fcd00..86c463388dd 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/ifnull.md
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
-### description
-#### Syntax
+## Description
-`ifnull(expr1, expr2)`
+Returns `<expr1>` if it is not `NULL`; otherwise, returns `<expr2>`.
+## Alias
-If the value of expr1 is not null, expr1 is returned, otherwise expr2 is
returned
+- NVL
-### example
+## Syntax
+```sql
+IFNULL(<expr1>, <expr2>)
```
-mysql> select ifnull(1,0);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first expression to check for `NULL`. |
+| `<expr2>` | The value to return if `<expr1>` is `NULL`. |
+
+## Return Value
+
+- Returns `<expr1>` if it is not `NULL`.
+- Otherwise, returns `<expr2>`.
+
+## Examples
+
+```sql
+SELECT IFNULL(1, 0);
+```
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
index 07a99354678..2348e227d5e 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
-### description
-#### Syntax
+## Description
-`nullif(expr1, expr2)`
+Returns `NULL` if the two input values are equal; otherwise, returns the first
input value. This function is equivalent to the following `CASE WHEN`
expression:
-
-If the two parameters are equal, null is returned. Otherwise, the value of the
first parameter is returned. It has the same effect as the following `case when`
-
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
-### example
+## Syntax
+```sql
+NULLIF(<expr1>, <expr2>)
```
-mysql> select nullif(1,1);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first input value to compare. |
+| `<expr2>` | The second input value to compare against the first. |
+
+## Return Value
+
+- Returns `NULL` if `<expr1>` is equal to `<expr2>`.
+- Otherwise, returns the value of `<expr1>`.
+
+## Examples
+
+```sql
+SELECT NULLIF(1, 1);
+```
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
-mysql> select nullif(1,0);
+```sql
+SELECT NULLIF(1, 0);
+```
+
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
index 279e7d80002..3d637696525 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
+## Description
+
+Compares multiple expressions and returns the greatest value among them. If
any argument is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+GREATEST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`greatest(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | A list of expressions to compare. Supports `TINYINT`,
`SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`, `STRING`,
`DATETIME`, and `DECIMAL` types. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compares the size of `n columns` and returns the largest among them. If there
is `NULL` in `column`, it returns `NULL`.
+- Returns the largest value among the given expressions.
+- If any argument is `NULL`, returns `NULL`.
-### example
+## Examples
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
index 7835d259c2b..316dbb0f77b 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/numeric-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
+## Description
+
+Compares multiple expressions and returns the smallest value among them. If
any parameter is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+LEAST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`least(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | The expressions to be compared. Supported types include
`TINYINT`, `SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`,
`STRING`, `DATETIME`, and `DECIMAL`. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compare the size of `n columns` and return the smallest among them. If there
is `NULL` in `column`, return `NULL`.
+- Returns the smallest value among the given expressions.
+- If any parameter is `NULL`, the function returns `NULL`.
-### example
+## Examples
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
index 08f6b56b604..063ae762c3f 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/not-null-or-empty.md
@@ -24,37 +24,60 @@ specific language governing permissions and limitations
under the License.
-->
-## not_null_or_empty
-### description
-#### Syntax
+## Description
-`BOOLEAN NOT_NULL_OR_EMPTY (VARCHAR str)`
+The `not_null_or_empty` function checks if the given value is neither NULL nor
empty. It returns true if the input value is not NULL and not an empty string,
otherwise, it returns false.
-It returns false if the string is an empty string or NULL. Otherwise it
returns true.
+## Syntax
-### example
+```sql
+NOT_NULL_OR_EMPTY (<str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| --------- | ------------------- |
+| `<str>` | The string to check |
+
+## Return Value
+Returns false if the string is an empty string or NULL, otherwise returns true.
+
+## Examples
+
+```sql
+select not_null_or_empty(null);
```
-MySQL [(none)]> select not_null_or_empty(null);
+
+```text
+-------------------------+
| not_null_or_empty(NULL) |
+-------------------------+
| 0 |
+-------------------------+
+```
+
+```sql
+select not_null_or_empty("");
+```
-MySQL [(none)]> select not_null_or_empty("");
+```text
+-----------------------+
| not_null_or_empty('') |
+-----------------------+
| 0 |
+-----------------------+
+```
-MySQL [(none)]> select not_null_or_empty("a");
+```sql
+select not_null_or_empty("a");
+```
+
+```text
+------------------------+
| not_null_or_empty('a') |
+------------------------+
| 1 |
+------------------------+
-```
-### keywords
- NOT_NULL_OR_EMPTY
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
index 87c60cee3b3..f0c5ec53e2d 100644
---
a/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
+++
b/versioned_docs/version-2.0/sql-manual/sql-functions/string-functions/null-or-empty.md
@@ -24,37 +24,60 @@ specific language governing permissions and limitations
under the License.
-->
-## null_or_empty
-### description
-#### Syntax
+## Description
-`BOOLEAN NULL_OR_EMPTY (VARCHAR str)`
+The `null_or_empty` function checks if the given value is NULL or an empty
string. It returns true if the input value is NULL or an empty string,
otherwise, it returns false.
-It returns true if the string is an empty string or NULL. Otherwise it returns
false.
+## Syntax
-### example
+```sql
+NULL_OR_EMPTY (<str>)
+```
+
+## Parameters
+
+| Parameter | Description |
+| --------- | ---------------------- |
+| `<str>` | The string to check. |
+
+## Return Value
+Returns true if the string is an empty string or NULL, otherwise returns false.
+
+## Examples
+
+```sql
+select null_or_empty(null);
```
-MySQL [(none)]> select null_or_empty(null);
+
+```text
+---------------------+
| null_or_empty(NULL) |
+---------------------+
| 1 |
+---------------------+
+```
+
+```sql
+select null_or_empty("");
+```
-MySQL [(none)]> select null_or_empty("");
+```text
+-------------------+
| null_or_empty('') |
+-------------------+
| 1 |
+-------------------+
+```
-MySQL [(none)]> select null_or_empty("a");
+```sql
+select null_or_empty("a");
+```
+
+```text
+--------------------+
| null_or_empty('a') |
+--------------------+
| 0 |
+--------------------+
-```
-### keywords
- NULL_OR_EMPTY
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 871c71d3b56..b8abdf5429f 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
-### description
-#### Syntax
+## Description
-`coalesce(expr1, expr2, ...., expr_n)`
+Returns the first non-null expression from left to right in the parameter
list. If all arguments are NULL, returns NULL.
+## Syntax
-Returns the first non empty expression in the parameter (from left to right)
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## Parameters
+
+| Parameter | Description
|
+| -------------- |
----------------------------------------------------------------------------- |
+| `<expr>` | A sequence of expressions to evaluate. All expressions must be
compatible data types. |
+
+## Return Value
-### example
+The first non-null expression in the parameter list. Returns NULL if all
arguments are NULL.
+## Examples
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-COALESCE
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index 279e7d80002..3d637696525 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
+## Description
+
+Compares multiple expressions and returns the greatest value among them. If
any argument is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+GREATEST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`greatest(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | A list of expressions to compare. Supports `TINYINT`,
`SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`, `STRING`,
`DATETIME`, and `DECIMAL` types. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compares the size of `n columns` and returns the largest among them. If there
is `NULL` in `column`, it returns `NULL`.
+- Returns the largest value among the given expressions.
+- If any argument is `NULL`, returns `NULL`.
-### example
+## Examples
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 4c23b08a58f..441103204f5 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,41 @@ specific language governing permissions and limitations
under the License.
-->
-## if
-### description
-#### Syntax
+## Description
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+Returns `valueTrue` when the condition is true, and returns `valueFalseOrNull`
otherwise. The return type is determined by the result of the
`valueTrue`/`valueFalseOrNull` expression.
+## Syntax
-Returns valueTrue when condition is true, returns valueFalseOrNull otherwise.
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+|-------------------------|--------------------------------------------------------------|
+| `<condition>` | The boolean condition to evaluate.
|
+| `<value_true>` | The value to return if `<condition>` evaluates to
true. |
+| `<value_false_or_null>` | The value to return if `<condition>` evaluates to
false. |
-The return type is the type of the result of the valueTrue/valueFalseOrNull
expression
+## Return Value
-### example
+The result of the IF expression:
+- Returns `valueTrue` when the condition is true.
+- Returns `valueFalseOrNull` when the condition is false.
+## Examples
+
+```sql
+SELECT user_id, IF(user_id = 1, 'true', 'false') AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 5b5493fcd00..86c463388dd 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
-### description
-#### Syntax
+## Description
-`ifnull(expr1, expr2)`
+Returns `<expr1>` if it is not `NULL`; otherwise, returns `<expr2>`.
+## Alias
-If the value of expr1 is not null, expr1 is returned, otherwise expr2 is
returned
+- NVL
-### example
+## Syntax
+```sql
+IFNULL(<expr1>, <expr2>)
```
-mysql> select ifnull(1,0);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first expression to check for `NULL`. |
+| `<expr2>` | The value to return if `<expr1>` is `NULL`. |
+
+## Return Value
+
+- Returns `<expr1>` if it is not `NULL`.
+- Otherwise, returns `<expr2>`.
+
+## Examples
+
+```sql
+SELECT IFNULL(1, 0);
+```
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 7835d259c2b..316dbb0f77b 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
+## Description
+
+Compares multiple expressions and returns the smallest value among them. If
any parameter is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+LEAST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`least(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | The expressions to be compared. Supported types include
`TINYINT`, `SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`,
`STRING`, `DATETIME`, and `DECIMAL`. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compare the size of `n columns` and return the smallest among them. If there
is `NULL` in `column`, return `NULL`.
+- Returns the smallest value among the given expressions.
+- If any parameter is `NULL`, the function returns `NULL`.
-### example
+## Examples
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index bfa440eb9cf..063ae762c3f 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -36,9 +36,9 @@ NOT_NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ------------------- |
+| `<str>` | The string to check |
## Return Value
@@ -46,11 +46,11 @@ Returns false if the string is an empty string or NULL,
otherwise returns true.
## Examples
-```
+```sql
select not_null_or_empty(null);
```
-```
+```text
+-------------------------+
| not_null_or_empty(NULL) |
+-------------------------+
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 8e69730d9c0..f0c5ec53e2d 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,9 +36,9 @@ NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ---------------------- |
+| `<str>` | The string to check. |
## Return Value
@@ -80,4 +80,4 @@ select null_or_empty("a");
+--------------------+
| 0 |
+--------------------+
-```
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 07a99354678..2348e227d5e 100644
---
a/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/versioned_docs/version-2.1/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
-### description
-#### Syntax
+## Description
-`nullif(expr1, expr2)`
+Returns `NULL` if the two input values are equal; otherwise, returns the first
input value. This function is equivalent to the following `CASE WHEN`
expression:
-
-If the two parameters are equal, null is returned. Otherwise, the value of the
first parameter is returned. It has the same effect as the following `case when`
-
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
-### example
+## Syntax
+```sql
+NULLIF(<expr1>, <expr2>)
```
-mysql> select nullif(1,1);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first input value to compare. |
+| `<expr2>` | The second input value to compare against the first. |
+
+## Return Value
+
+- Returns `NULL` if `<expr1>` is equal to `<expr2>`.
+- Otherwise, returns the value of `<expr1>`.
+
+## Examples
+
+```sql
+SELECT NULLIF(1, 1);
+```
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
-mysql> select nullif(1,0);
+```sql
+SELECT NULLIF(1, 0);
+```
+
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
index 871c71d3b56..b8abdf5429f 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/coalesce.md
@@ -24,24 +24,36 @@ specific language governing permissions and limitations
under the License.
-->
-## coalesce
-### description
-#### Syntax
+## Description
-`coalesce(expr1, expr2, ...., expr_n)`
+Returns the first non-null expression from left to right in the parameter
list. If all arguments are NULL, returns NULL.
+## Syntax
-Returns the first non empty expression in the parameter (from left to right)
+```sql
+COALESCE(<expr> [, ...])
+```
+
+## Parameters
+
+| Parameter | Description
|
+| -------------- |
----------------------------------------------------------------------------- |
+| `<expr>` | A sequence of expressions to evaluate. All expressions must be
compatible data types. |
+
+## Return Value
-### example
+The first non-null expression in the parameter list. Returns NULL if all
arguments are NULL.
+## Examples
+
+```sql
+SELECT COALESCE(NULL, '1111', '0000');
```
-mysql> select coalesce(NULL, '1111', '0000');
+
+```text
+--------------------------------+
| coalesce(NULL, '1111', '0000') |
+--------------------------------+
| 1111 |
+--------------------------------+
-```
-### keywords
-COALESCE
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
index 279e7d80002..3d637696525 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/greatest.md
@@ -13,7 +13,9 @@ 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
@@ -22,45 +24,73 @@ specific language governing permissions and limitations
under the License.
-->
-## greatest
+## Description
+
+Compares multiple expressions and returns the greatest value among them. If
any argument is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+GREATEST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`greatest(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | A list of expressions to compare. Supports `TINYINT`,
`SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`, `STRING`,
`DATETIME`, and `DECIMAL` types. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compares the size of `n columns` and returns the largest among them. If there
is `NULL` in `column`, it returns `NULL`.
+- Returns the largest value among the given expressions.
+- If any argument is `NULL`, returns `NULL`.
-### example
+## Examples
+```sql
+SELECT GREATEST(-1, 0, 5, 8);
```
-mysql> select greatest(-1, 0, 5, 8);
+
+```text
+-----------------------+
-| greatest(-1, 0, 5, 8) |
+| GREATEST(-1, 0, 5, 8) |
+-----------------------+
| 8 |
+-----------------------+
-mysql> select greatest(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT GREATEST(-1, 0, 5, NULL);
+```
+
+```text
+--------------------------+
-| greatest(-1, 0, 5, NULL) |
+| GREATEST(-1, 0, 5, NULL) |
+--------------------------+
| NULL |
+--------------------------+
-mysql> select greatest(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT GREATEST(6.3, 4.29, 7.6876);
+```
+
+```text
+-----------------------------+
-| greatest(6.3, 4.29, 7.6876) |
+| GREATEST(6.3, 4.29, 7.6876) |
+-----------------------------+
| 7.6876 |
+-----------------------------+
-mysql> select greatest("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+-------------------------------------------------------------------------------+
-| greatest('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+| GREATEST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11') |
+-------------------------------------------------------------------------------+
| 2022-02-26 20:02:11
|
+-------------------------------------------------------------------------------+
-```
-
-### keywords
- GREATEST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
index 4c23b08a58f..441103204f5 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/if.md
@@ -24,27 +24,41 @@ specific language governing permissions and limitations
under the License.
-->
-## if
-### description
-#### Syntax
+## Description
-`if(boolean condition, type valueTrue, type valueFalseOrNull)`
+Returns `valueTrue` when the condition is true, and returns `valueFalseOrNull`
otherwise. The return type is determined by the result of the
`valueTrue`/`valueFalseOrNull` expression.
+## Syntax
-Returns valueTrue when condition is true, returns valueFalseOrNull otherwise.
+```sql
+IF(<condition>, <value_true>, <value_false_or_null>)
+```
+
+## Parameters
+
+| Parameter | Description
|
+|-------------------------|--------------------------------------------------------------|
+| `<condition>` | The boolean condition to evaluate.
|
+| `<value_true>` | The value to return if `<condition>` evaluates to
true. |
+| `<value_false_or_null>` | The value to return if `<condition>` evaluates to
false. |
-The return type is the type of the result of the valueTrue/valueFalseOrNull
expression
+## Return Value
-### example
+The result of the IF expression:
+- Returns `valueTrue` when the condition is true.
+- Returns `valueFalseOrNull` when the condition is false.
+## Examples
+
+```sql
+SELECT user_id, IF(user_id = 1, 'true', 'false') AS test_if FROM test;
```
-mysql> select user_id, if(user_id = 1, "true", "false") test_if from test;
+
+```text
+---------+---------+
| user_id | test_if |
+---------+---------+
| 1 | true |
| 2 | false |
+---------+---------+
-```
-### keywords
-IF
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
index 5b5493fcd00..86c463388dd 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/ifnull.md
@@ -24,31 +24,54 @@ specific language governing permissions and limitations
under the License.
-->
-## ifnull
-### description
-#### Syntax
+## Description
-`ifnull(expr1, expr2)`
+Returns `<expr1>` if it is not `NULL`; otherwise, returns `<expr2>`.
+## Alias
-If the value of expr1 is not null, expr1 is returned, otherwise expr2 is
returned
+- NVL
-### example
+## Syntax
+```sql
+IFNULL(<expr1>, <expr2>)
```
-mysql> select ifnull(1,0);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first expression to check for `NULL`. |
+| `<expr2>` | The value to return if `<expr1>` is `NULL`. |
+
+## Return Value
+
+- Returns `<expr1>` if it is not `NULL`.
+- Otherwise, returns `<expr2>`.
+
+## Examples
+
+```sql
+SELECT IFNULL(1, 0);
+```
+
+```text
+--------------+
-| ifnull(1, 0) |
+| IFNULL(1, 0) |
+--------------+
| 1 |
+--------------+
+```
-mysql> select ifnull(null,10);
+```sql
+SELECT IFNULL(NULL, 10);
+```
+
+```text
+------------------+
-| ifnull(NULL, 10) |
+| IFNULL(NULL, 10) |
+------------------+
| 10 |
+------------------+
-```
-### keywords
-IFNULL
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
index 7835d259c2b..316dbb0f77b 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/least.md
@@ -13,6 +13,7 @@ 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
@@ -22,45 +23,73 @@ specific language governing permissions and limitations
under the License.
-->
-## least
+## Description
+
+Compares multiple expressions and returns the smallest value among them. If
any parameter is `NULL`, the function returns `NULL`.
+
+## Syntax
+
+```sql
+LEAST(<expr> [, ...])
+```
-### description
-#### Syntax
+## Parameters
-`least(col_a, col_b, …, col_n)`
+| Parameter | Description |
+|------------|-------------|
+| `<expr>` | The expressions to be compared. Supported types include
`TINYINT`, `SMALLINT`, `INT`, `BIGINT`, `LARGEINT`, `FLOAT`, `DOUBLE`,
`STRING`, `DATETIME`, and `DECIMAL`. |
-`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT`
`LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL`
+## Return Value
-Compare the size of `n columns` and return the smallest among them. If there
is `NULL` in `column`, return `NULL`.
+- Returns the smallest value among the given expressions.
+- If any parameter is `NULL`, the function returns `NULL`.
-### example
+## Examples
+```sql
+SELECT LEAST(-1, 0, 5, 8);
```
-mysql> select least(-1, 0, 5, 8);
+
+```text
+--------------------+
-| least(-1, 0, 5, 8) |
+| LEAST(-1, 0, 5, 8) |
+--------------------+
| -1 |
+--------------------+
-mysql> select least(-1, 0, 5, NULL);
+```
+
+```sql
+SELECT LEAST(-1, 0, 5, NULL);
+```
+
+```text
+-----------------------+
-| least(-1, 0, 5, NULL) |
+| LEAST(-1, 0, 5, NULL) |
+-----------------------+
| NULL |
+-----------------------+
-mysql> select least(6.3, 4.29, 7.6876);
+```
+
+```sql
+SELECT LEAST(6.3, 4.29, 7.6876);
+```
+
+```text
+--------------------------+
-| least(6.3, 4.29, 7.6876) |
+| LEAST(6.3, 4.29, 7.6876) |
+--------------------------+
| 4.29 |
+--------------------------+
-mysql> select least("2022-02-26 20:02:11","2020-01-23 20:02:11","2020-06-22
20:02:11");
+```
+
+```sql
+SELECT LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22
20:02:11');
+```
+
+```text
+----------------------------------------------------------------------------+
-| least('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+| LEAST('2022-02-26 20:02:11', '2020-01-23 20:02:11', '2020-06-22 20:02:11') |
+----------------------------------------------------------------------------+
| 2020-01-23 20:02:11 |
+----------------------------------------------------------------------------+
-```
-
-### keywords
- LEAST
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
index bfa440eb9cf..063ae762c3f 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md
@@ -36,9 +36,9 @@ NOT_NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ------------------- |
+| `<str>` | The string to check |
## Return Value
@@ -46,11 +46,11 @@ Returns false if the string is an empty string or NULL,
otherwise returns true.
## Examples
-```
+```sql
select not_null_or_empty(null);
```
-```
+```text
+-------------------------+
| not_null_or_empty(NULL) |
+-------------------------+
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
index 8e69730d9c0..f0c5ec53e2d 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/null-or-empty.md
@@ -36,9 +36,9 @@ NULL_OR_EMPTY (<str>)
## Parameters
-| Parameter | Description |
-| -- | -- |
-| `<str>` | The string to check |
+| Parameter | Description |
+| --------- | ---------------------- |
+| `<str>` | The string to check. |
## Return Value
@@ -80,4 +80,4 @@ select null_or_empty("a");
+--------------------+
| 0 |
+--------------------+
-```
+```
\ No newline at end of file
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
index 07a99354678..2348e227d5e 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/scalar-functions/conditional-functions/nullif.md
@@ -24,38 +24,57 @@ specific language governing permissions and limitations
under the License.
-->
-## nullif
-### description
-#### Syntax
+## Description
-`nullif(expr1, expr2)`
+Returns `NULL` if the two input values are equal; otherwise, returns the first
input value. This function is equivalent to the following `CASE WHEN`
expression:
-
-If the two parameters are equal, null is returned. Otherwise, the value of the
first parameter is returned. It has the same effect as the following `case when`
-
-```
+```sql
CASE
- WHEN expr1 = expr2 THEN NULL
- ELSE expr1
+ WHEN <expr1> = <expr2> THEN NULL
+ ELSE <expr1>
END
```
-### example
+## Syntax
+```sql
+NULLIF(<expr1>, <expr2>)
```
-mysql> select nullif(1,1);
+
+## Parameters
+
+| Parameter | Description |
+|-----------|-------------|
+| `<expr1>` | The first input value to compare. |
+| `<expr2>` | The second input value to compare against the first. |
+
+## Return Value
+
+- Returns `NULL` if `<expr1>` is equal to `<expr2>`.
+- Otherwise, returns the value of `<expr1>`.
+
+## Examples
+
+```sql
+SELECT NULLIF(1, 1);
+```
+
+```text
+--------------+
-| nullif(1, 1) |
+| NULLIF(1, 1) |
+--------------+
| NULL |
+--------------+
+```
-mysql> select nullif(1,0);
+```sql
+SELECT NULLIF(1, 0);
+```
+
+```text
+--------------+
-| nullif(1, 0) |
+| NULLIF(1, 0) |
+--------------+
| 1 |
+--------------+
-```
-### keywords
-NULLIF
+```
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]