This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 0a3c706b5f9 [Feature](function) Support function quarters_add/sub for
nereids (#1654)
0a3c706b5f9 is described below
commit 0a3c706b5f9325788d1eabc593a03eb1e8b01318
Author: zclllyybb <[email protected]>
AuthorDate: Thu Jan 2 11:00:26 2025 +0800
[Feature](function) Support function quarters_add/sub for nereids (#1654)
pr: https://github.com/apache/doris/pull/45370
## Versions
- [x] dev
- [x] 3.0
- [ ] 2.1
- [ ] 2.0
## Languages
- [x] Chinese
- [x] English
## Docs Checklist
- [ ] Checked by AI
- [ ] Test Cases Built
---
.../sql-functions/date-time-functions/date-add.md | 13 ++++----
.../sql-functions/date-time-functions/date-sub.md | 13 ++++----
.../{date-add.md => quarters-add.md} | 34 +++++++++-----------
.../{date-add.md => quarters-sub.md} | 34 +++++++++-----------
.../sql-functions/date-time-functions/date-add.md | 16 ++++------
.../sql-functions/date-time-functions/date-sub.md | 16 ++++------
.../date-time-functions/quarters-add.md} | 36 +++++++++------------
.../date-time-functions/quarters-sub.md} | 37 +++++++++-------------
.../sql-functions/date-time-functions/date-add.md | 16 ++++------
.../sql-functions/date-time-functions/date-sub.md | 16 ++++------
.../{date-add.md => quarters-add.md} | 36 +++++++++------------
.../{date-add.md => quarters-sub.md} | 37 +++++++++-------------
sidebars.json | 2 ++
.../sql-functions/date-time-functions/date-add.md | 13 ++++----
.../sql-functions/date-time-functions/date-sub.md | 13 ++++----
.../date-time-functions/quarters-add.md | 34 +++++++++-----------
.../date-time-functions/quarters-sub.md | 34 +++++++++-----------
versioned_sidebars/version-3.0-sidebars.json | 2 ++
18 files changed, 176 insertions(+), 226 deletions(-)
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
b/docs/sql-manual/sql-functions/date-time-functions/date-add.md
index 468ca18723c..7e4282da887 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
+++ b/docs/sql-manual/sql-functions/date-time-functions/date-add.md
@@ -24,7 +24,6 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
@@ -33,15 +32,15 @@ under the License.
Adds a specified time interval to the date.
-The date parameter is a valid date expression.
+The `date` parameter is a valid date expression.
-The expr parameter is the interval you want to add.
+The `expr` parameter is the interval you want to add.
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
+The `type` parameter can be the following values: YEAR, QUARTER, MONTH, DAY,
HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -49,5 +48,5 @@ mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
| 2010-12-02 23:59:59 |
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_ADD,DATE,ADD
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-sub.md
b/docs/sql-manual/sql-functions/date-time-functions/date-sub.md
index c042ae45c77..29272d4ccdb 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-sub.md
+++ b/docs/sql-manual/sql-functions/date-time-functions/date-sub.md
@@ -24,7 +24,6 @@ specific language governing permissions and limitations
under the License.
-->
-## date_sub
### Description
#### Syntax
@@ -33,15 +32,15 @@ under the License.
Subtract the specified time interval from the date
-The date parameter is a valid date expression.
+The `date` parameter is a valid date expression.
-The expr parameter is the interval you want to add.
+The `expr` parameter is the interval you want to add.
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
+The `type` parameter can be the following values: YEAR, QUARTER, MONTH, DAY,
HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -49,5 +48,5 @@ mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
| 2010-11-28 23:59:59 |
+-------------------------------------------------+
```
-### keywords
+### Keywords
Date, date, date
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
b/docs/sql-manual/sql-functions/date-time-functions/quarters-add.md
similarity index 54%
copy from docs/sql-manual/sql-functions/date-time-functions/date-add.md
copy to docs/sql-manual/sql-functions/date-time-functions/quarters-add.md
index 468ca18723c..94f02780654 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
+++ b/docs/sql-manual/sql-functions/date-time-functions/quarters-add.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_ADD",
"language": "en"
}
---
@@ -24,30 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
-`DATETIME DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_ADD(DATE/DATETIME date, INT years)`
+Add a specified number of quarters to a given date
-Adds a specified time interval to the date.
+The parameter `date` can be of type `DATETIME` or `DATE`, and the return type
is the same as the type of the parameter `date`.
-The date parameter is a valid date expression.
-
-The expr parameter is the interval you want to add.
-
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
-
-### example
+### Example
+```sql
+mysql> select quarters_add("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_add(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2020-04-30 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
-```
+
### keywords
- DATE_ADD,DATE,ADD
+ QUARTERS, ADD, QUARTERS_ADD
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
b/docs/sql-manual/sql-functions/date-time-functions/quarters-sub.md
similarity index 53%
copy from docs/sql-manual/sql-functions/date-time-functions/date-add.md
copy to docs/sql-manual/sql-functions/date-time-functions/quarters-sub.md
index 468ca18723c..cab6ada0e81 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
+++ b/docs/sql-manual/sql-functions/date-time-functions/quarters-sub.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_SUB",
"language": "en"
}
---
@@ -24,30 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
-`DATETIME DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_SUB(DATE/DATETIME date, INT years)`
+Subtract a specified number of quarters for a given date
-Adds a specified time interval to the date.
+The parameter `date` can be of type `DATETIME` or `DATE`, and the return type
is the same as the type of the parameter `date`.
-The date parameter is a valid date expression.
-
-The expr parameter is the interval you want to add.
-
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
-
-### example
+### Example
+```sql
+mysql> select quarters_sub("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_sub(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2019-10-31 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
-```
+
### keywords
- DATE_ADD,DATE,ADD
+ QUARTERS, SUB, QUARTERS_SUB
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-add.md
index c9fd993f57d..c4c63b04aa4 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-add.md
@@ -24,24 +24,22 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
-
向日期添加指定的时间间隔。
-date 参数是合法的日期表达式。
+`date` 参数是合法的日期表达式。
-expr 参数是您希望添加的时间间隔。
+`expr` 参数是您希望添加的时间间隔。
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
+`type` 参数可以是下列值:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -50,6 +48,6 @@ mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_ADD,DATE,ADD
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-sub.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-sub.md
index ceb7e2356fc..144ada74b12 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-sub.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/date-sub.md
@@ -24,24 +24,22 @@ specific language governing permissions and limitations
under the License.
-->
-## date_sub
-### description
+### Description
#### Syntax
`DATETIME DATE_SUB(DATETIME date, INTERVAL expr type)`
-
从日期减去指定的时间间隔
-date 参数是合法的日期表达式。
+`date` 参数是合法的日期表达式。
-expr 参数是您希望添加的时间间隔。
+`expr` 参数是您希望添加的时间间隔。
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
+`type` 参数可以是下列值:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -50,6 +48,6 @@ mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_SUB,DATE,SUB
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-add.md
similarity index 54%
copy from
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-add.md
index c9fd993f57d..393c4659614 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-add.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_ADD",
"language": "zh-CN"
}
---
@@ -24,32 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
-`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_ADD(DATE/DATETIME date, INT years)`
+对给定日期加上指定数量的季度
-向日期添加指定的时间间隔。
+参数 `date` 可以是 `DATETIME` 或者 `DATE` 类型,返回类型与参数 `date` 的类型一致。
-date 参数是合法的日期表达式。
-
-expr 参数是您希望添加的时间间隔。
-
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
-
-### example
+### Example
-```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
+```sql
+mysql> select quarters_add("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_add(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2020-04-30 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
### keywords
-
- DATE_ADD,DATE,ADD
+ QUARTERS, ADD, QUARTERS_ADD
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-sub.md
similarity index 54%
copy from
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-sub.md
index c9fd993f57d..3005dc7d56b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/date-time-functions/quarters-sub.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_SUB",
"language": "zh-CN"
}
---
@@ -24,32 +24,25 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
-`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_SUB(DATE/DATETIME date, INT years)`
+对给定日期减去指定数量的季度
-向日期添加指定的时间间隔。
+参数 `date` 可以是 `DATETIME` 或者 `DATE` 类型,返回类型与参数 `date` 的类型一致。
+### Example
-date 参数是合法的日期表达式。
-
-expr 参数是您希望添加的时间间隔。
-
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
-
-### example
-
-```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
+```sql
+mysql> select quarters_sub("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_sub(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2019-10-31 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
### keywords
-
- DATE_ADD,DATE,ADD
+ QUARTERS, SUB, QUARTERS_SUB
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
index c9fd993f57d..c4c63b04aa4 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
@@ -24,24 +24,22 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
-
向日期添加指定的时间间隔。
-date 参数是合法的日期表达式。
+`date` 参数是合法的日期表达式。
-expr 参数是您希望添加的时间间隔。
+`expr` 参数是您希望添加的时间间隔。
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
+`type` 参数可以是下列值:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -50,6 +48,6 @@ mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_ADD,DATE,ADD
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
index ceb7e2356fc..144ada74b12 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
@@ -24,24 +24,22 @@ specific language governing permissions and limitations
under the License.
-->
-## date_sub
-### description
+### Description
#### Syntax
`DATETIME DATE_SUB(DATETIME date, INTERVAL expr type)`
-
从日期减去指定的时间间隔
-date 参数是合法的日期表达式。
+`date` 参数是合法的日期表达式。
-expr 参数是您希望添加的时间间隔。
+`expr` 参数是您希望添加的时间间隔。
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
+`type` 参数可以是下列值:YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -50,6 +48,6 @@ mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_SUB,DATE,SUB
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
similarity index 54%
copy from
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
index c9fd993f57d..393c4659614 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_ADD",
"language": "zh-CN"
}
---
@@ -24,32 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
-`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_ADD(DATE/DATETIME date, INT years)`
+对给定日期加上指定数量的季度
-向日期添加指定的时间间隔。
+参数 `date` 可以是 `DATETIME` 或者 `DATE` 类型,返回类型与参数 `date` 的类型一致。
-date 参数是合法的日期表达式。
-
-expr 参数是您希望添加的时间间隔。
-
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
-
-### example
+### Example
-```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
+```sql
+mysql> select quarters_add("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_add(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2020-04-30 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
### keywords
-
- DATE_ADD,DATE,ADD
+ QUARTERS, ADD, QUARTERS_ADD
diff --git
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
similarity index 54%
copy from
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
index c9fd993f57d..3005dc7d56b 100644
---
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_SUB",
"language": "zh-CN"
}
---
@@ -24,32 +24,25 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
-### description
+### Description
#### Syntax
-`INT DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_SUB(DATE/DATETIME date, INT years)`
+对给定日期减去指定数量的季度
-向日期添加指定的时间间隔。
+参数 `date` 可以是 `DATETIME` 或者 `DATE` 类型,返回类型与参数 `date` 的类型一致。
+### Example
-date 参数是合法的日期表达式。
-
-expr 参数是您希望添加的时间间隔。
-
-type 参数可以是下列值:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
-
-### example
-
-```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
+```sql
+mysql> select quarters_sub("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_sub(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2019-10-31 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
### keywords
-
- DATE_ADD,DATE,ADD
+ QUARTERS, SUB, QUARTERS_SUB
diff --git a/sidebars.json b/sidebars.json
index e1be6af90b0..53e0609779f 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -1071,6 +1071,8 @@
"sql-manual/sql-functions/date-time-functions/months-add",
"sql-manual/sql-functions/date-time-functions/months-diff",
"sql-manual/sql-functions/date-time-functions/months-sub",
+
"sql-manual/sql-functions/date-time-functions/quarters-sub",
+
"sql-manual/sql-functions/date-time-functions/quarters-add",
"sql-manual/sql-functions/date-time-functions/years-add",
"sql-manual/sql-functions/date-time-functions/years-diff",
"sql-manual/sql-functions/date-time-functions/years-sub"
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
index 468ca18723c..7e4282da887 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-add.md
@@ -24,7 +24,6 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
@@ -33,15 +32,15 @@ under the License.
Adds a specified time interval to the date.
-The date parameter is a valid date expression.
+The `date` parameter is a valid date expression.
-The expr parameter is the interval you want to add.
+The `expr` parameter is the interval you want to add.
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
+The `type` parameter can be the following values: YEAR, QUARTER, MONTH, DAY,
HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -49,5 +48,5 @@ mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
| 2010-12-02 23:59:59 |
+-------------------------------------------------+
```
-### keywords
+### Keywords
DATE_ADD,DATE,ADD
diff --git
a/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
index c042ae45c77..29272d4ccdb 100644
---
a/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/date-sub.md
@@ -24,7 +24,6 @@ specific language governing permissions and limitations
under the License.
-->
-## date_sub
### Description
#### Syntax
@@ -33,15 +32,15 @@ under the License.
Subtract the specified time interval from the date
-The date parameter is a valid date expression.
+The `date` parameter is a valid date expression.
-The expr parameter is the interval you want to add.
+The `expr` parameter is the interval you want to add.
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
+The `type` parameter can be the following values: YEAR, QUARTER, MONTH, DAY,
HOUR, MINUTE, SECOND
-### example
+### Example
-```
+```sql
mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
+-------------------------------------------------+
| date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY) |
@@ -49,5 +48,5 @@ mysql> select date_sub('2010-11-30 23:59:59', INTERVAL 2 DAY);
| 2010-11-28 23:59:59 |
+-------------------------------------------------+
```
-### keywords
+### Keywords
Date, date, date
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
similarity index 54%
copy from docs/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
index 468ca18723c..94f02780654 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-add.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_ADD",
"language": "en"
}
---
@@ -24,30 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
-`DATETIME DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_ADD(DATE/DATETIME date, INT years)`
+Add a specified number of quarters to a given date
-Adds a specified time interval to the date.
+The parameter `date` can be of type `DATETIME` or `DATE`, and the return type
is the same as the type of the parameter `date`.
-The date parameter is a valid date expression.
-
-The expr parameter is the interval you want to add.
-
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
-
-### example
+### Example
+```sql
+mysql> select quarters_add("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_add(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2020-04-30 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
-```
+
### keywords
- DATE_ADD,DATE,ADD
+ QUARTERS, ADD, QUARTERS_ADD
diff --git a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
similarity index 53%
copy from docs/sql-manual/sql-functions/date-time-functions/date-add.md
copy to
versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
index 468ca18723c..cab6ada0e81 100644
--- a/docs/sql-manual/sql-functions/date-time-functions/date-add.md
+++
b/versioned_docs/version-3.0/sql-manual/sql-functions/date-time-functions/quarters-sub.md
@@ -1,6 +1,6 @@
---
{
- "title": "DATE_ADD",
+ "title": "QUARTERS_SUB",
"language": "en"
}
---
@@ -24,30 +24,26 @@ specific language governing permissions and limitations
under the License.
-->
-## date_add
### Description
#### Syntax
-`DATETIME DATE_ADD(DATETIME date, INTERVAL expr type)`
+`DATE/DATETIME QUARTERS_SUB(DATE/DATETIME date, INT years)`
+Subtract a specified number of quarters for a given date
-Adds a specified time interval to the date.
+The parameter `date` can be of type `DATETIME` or `DATE`, and the return type
is the same as the type of the parameter `date`.
-The date parameter is a valid date expression.
-
-The expr parameter is the interval you want to add.
-
-The type parameter can be the following values: YEAR, MONTH, DAY, HOUR,
MINUTE, SECOND
-
-### example
+### Example
+```sql
+mysql> select quarters_sub("2020-01-31 02:02:02", 1);
++---------------------------------------------------------------+
+| quarters_sub(cast('2020-01-31 02:02:02' as DATETIMEV2(0)), 1) |
++---------------------------------------------------------------+
+| 2019-10-31 02:02:02 |
++---------------------------------------------------------------+
+1 row in set (0.10 sec)
```
-mysql> select date_add('2010-11-30 23:59:59', INTERVAL 2 DAY);
-+-------------------------------------------------+
-| date_add('2010-11-30 23:59:59', INTERVAL 2 DAY) |
-+-------------------------------------------------+
-| 2010-12-02 23:59:59 |
-+-------------------------------------------------+
-```
+
### keywords
- DATE_ADD,DATE,ADD
+ QUARTERS, SUB, QUARTERS_SUB
diff --git a/versioned_sidebars/version-3.0-sidebars.json
b/versioned_sidebars/version-3.0-sidebars.json
index 76b3662074b..11f9e631f06 100644
--- a/versioned_sidebars/version-3.0-sidebars.json
+++ b/versioned_sidebars/version-3.0-sidebars.json
@@ -1067,6 +1067,8 @@
"sql-manual/sql-functions/date-time-functions/months-add",
"sql-manual/sql-functions/date-time-functions/months-diff",
"sql-manual/sql-functions/date-time-functions/months-sub",
+
"sql-manual/sql-functions/date-time-functions/quarters-sub",
+
"sql-manual/sql-functions/date-time-functions/quarters-add",
"sql-manual/sql-functions/date-time-functions/years-add",
"sql-manual/sql-functions/date-time-functions/years-diff",
"sql-manual/sql-functions/date-time-functions/years-sub"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]