This is an automated email from the ASF dual-hosted git repository. jiafengzheng 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 75f18ccbf45 [doc] Add docs of math function (#103) 75f18ccbf45 is described below commit 75f18ccbf4549cee13f459da9842b63df86da897 Author: TaoZex <45089228+tao...@users.noreply.github.com> AuthorDate: Tue Sep 20 13:05:46 2022 +0800 [doc] Add docs of math function (#103) * math-function * math-function --- .../sql-manual/sql-functions/math-functions/abs.md | 62 ++++++++++++++++++++ .../sql-functions/math-functions/acos.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/asin.md | 51 +++++++++++++++++ .../sql-functions/math-functions/atan.md | 51 +++++++++++++++++ .../sql-manual/sql-functions/math-functions/bin.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/ceil.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/cos.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/degrees.md | 57 +++++++++++++++++++ docs/sql-manual/sql-functions/math-functions/e.md | 45 +++++++++++++++ .../sql-manual/sql-functions/math-functions/exp.md | 51 +++++++++++++++++ .../sql-functions/math-functions/floor.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/greatest.md | 66 ++++++++++++++++++++++ .../sql-functions/math-functions/least.md | 66 ++++++++++++++++++++++ docs/sql-manual/sql-functions/math-functions/ln.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/log.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/log10.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/log2.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/negative.md | 51 +++++++++++++++++ docs/sql-manual/sql-functions/math-functions/pi.md | 45 +++++++++++++++ .../sql-functions/math-functions/positive.md | 51 +++++++++++++++++ .../sql-manual/sql-functions/math-functions/pow.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/radians.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/round.md | 63 +++++++++++++++++++++ .../sql-functions/math-functions/sign.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/sin.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/sqrt.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/tan.md | 51 +++++++++++++++++ .../sql-functions/math-functions/truncate.md | 62 ++++++++++++++++++++ .../sql-manual/sql-functions/math-functions/abs.md | 62 ++++++++++++++++++++ .../sql-functions/math-functions/acos.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/asin.md | 51 +++++++++++++++++ .../sql-functions/math-functions/atan.md | 51 +++++++++++++++++ .../sql-manual/sql-functions/math-functions/bin.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/ceil.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/cos.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/degrees.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/e.md | 45 +++++++++++++++ .../sql-manual/sql-functions/math-functions/exp.md | 51 +++++++++++++++++ .../sql-functions/math-functions/floor.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/greatest.md | 66 ++++++++++++++++++++++ .../sql-functions/math-functions/least.md | 66 ++++++++++++++++++++++ .../sql-manual/sql-functions/math-functions/ln.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/log.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/log10.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/log2.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/negative.md | 51 +++++++++++++++++ .../sql-manual/sql-functions/math-functions/pi.md | 45 +++++++++++++++ .../sql-functions/math-functions/positive.md | 51 +++++++++++++++++ .../sql-manual/sql-functions/math-functions/pow.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/radians.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/round.md | 63 +++++++++++++++++++++ .../sql-functions/math-functions/sign.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/sin.md | 57 +++++++++++++++++++ .../sql-functions/math-functions/sqrt.md | 57 +++++++++++++++++++ .../sql-manual/sql-functions/math-functions/tan.md | 51 +++++++++++++++++ .../sql-functions/math-functions/truncate.md | 62 ++++++++++++++++++++ sidebars.json | 29 +++++++++- 57 files changed, 3168 insertions(+), 1 deletion(-) diff --git a/docs/sql-manual/sql-functions/math-functions/abs.md b/docs/sql-manual/sql-functions/math-functions/abs.md new file mode 100644 index 00000000000..f8c3d0fd2d1 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/abs.md @@ -0,0 +1,62 @@ +--- +{ + "title": "abs", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## abs + +### description +#### Syntax + +`DOUBLE abs(DOUBLE x)` `SMALLINT abs(TINYINT x)` `INT abs(SMALLINT x)` + +`BIGINT abs(INT x)` `LARGEINT abs(BIGINT x)` `LARGEINT abs(LARGEINT x)` + +`DOUBLE abs(DOUBLE x)` `FLOAT abs(FLOAT x)` `DECIMAL abs(DECIMAL x)` + +Returns the absolute value of `x`. + +### example + +``` +mysql> select abs(-2); ++---------+ +| abs(-2) | ++---------+ +| 2 | ++---------+ +mysql> select abs(3.254655654); ++------------------+ +| abs(3.254655654) | ++------------------+ +| 3.254655654 | ++------------------+ +mysql> select abs(-3254654236547654354654767); ++---------------------------------+ +| abs(-3254654236547654354654767) | ++---------------------------------+ +| 3254654236547654354654767 | ++---------------------------------+ +``` + +### keywords + ABS diff --git a/docs/sql-manual/sql-functions/math-functions/acos.md b/docs/sql-manual/sql-functions/math-functions/acos.md new file mode 100644 index 00000000000..46b03f244e9 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/acos.md @@ -0,0 +1,57 @@ +--- +{ + "title": "acos", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## acos + +### description +#### Syntax + +`DOUBLE acos(DOUBLE x)` +Returns the arc cosine of `x`, or `nan` if `x` is not in the range `-1` to `1`. + +### example + +``` +mysql> select acos(1); ++-----------+ +| acos(1.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select acos(0); ++--------------------+ +| acos(0.0) | ++--------------------+ +| 1.5707963267948966 | ++--------------------+ +mysql> select acos(-2); ++------------+ +| acos(-2.0) | ++------------+ +| nan | ++------------+ +``` + +### keywords + ACOS diff --git a/docs/sql-manual/sql-functions/math-functions/asin.md b/docs/sql-manual/sql-functions/math-functions/asin.md new file mode 100644 index 00000000000..7d7b21502bf --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/asin.md @@ -0,0 +1,51 @@ +--- +{ + "title": "asin", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## asin + +### description +#### Syntax + +`DOUBLE asin(DOUBLE x)` +Returns the arc sine of `x`, or `nan` if `x` is not in the range `-1` to `1`. + +### example + +``` +mysql> select asin(0.5); ++---------------------+ +| asin(0.5) | ++---------------------+ +| 0.52359877559829893 | ++---------------------+ +mysql> select asin(2); ++-----------+ +| asin(2.0) | ++-----------+ +| nan | ++-----------+ +``` + +### keywords + ASIN diff --git a/docs/sql-manual/sql-functions/math-functions/atan.md b/docs/sql-manual/sql-functions/math-functions/atan.md new file mode 100644 index 00000000000..9693211a2bf --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/atan.md @@ -0,0 +1,51 @@ +--- +{ + "title": "atan", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## atan + +### description +#### Syntax + +`DOUBLE atan(DOUBLE x)` +Returns the arctangent of `x`, where `x` is in radians. + +### example + +``` +mysql> select atan(0); ++-----------+ +| atan(0.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select atan(2); ++--------------------+ +| atan(2.0) | ++--------------------+ +| 1.1071487177940904 | ++--------------------+ +``` + +### keywords + ATAN diff --git a/docs/sql-manual/sql-functions/math-functions/bin.md b/docs/sql-manual/sql-functions/math-functions/bin.md new file mode 100644 index 00000000000..93701ac41c8 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/bin.md @@ -0,0 +1,57 @@ +--- +{ + "title": "bin", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## bin + +### description +#### Syntax + +`STRING bin(BIGINT x)` +Convert the decimal number `x` to binary. + +### example + +``` +mysql> select bin(0); ++--------+ +| bin(0) | ++--------+ +| 0 | ++--------+ +mysql> select bin(10); ++---------+ +| bin(10) | ++---------+ +| 1010 | ++---------+ +mysql> select bin(-3); ++------------------------------------------------------------------+ +| bin(-3) | ++------------------------------------------------------------------+ +| 1111111111111111111111111111111111111111111111111111111111111101 | ++------------------------------------------------------------------+ +``` + +### keywords + BIN diff --git a/docs/sql-manual/sql-functions/math-functions/ceil.md b/docs/sql-manual/sql-functions/math-functions/ceil.md new file mode 100644 index 00000000000..722a681791d --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/ceil.md @@ -0,0 +1,57 @@ +--- +{ + "title": "ceil", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## ceil + +### description +#### Syntax + +`BIGINT ceil(DOUBLE x)` +Returns the smallest integer value greater than or equal to `x`. + +### example + +``` +mysql> select ceil(1); ++-----------+ +| ceil(1.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select ceil(2.4); ++-----------+ +| ceil(2.4) | ++-----------+ +| 3 | ++-----------+ +mysql> select ceil(-10.3); ++-------------+ +| ceil(-10.3) | ++-------------+ +| -10 | ++-------------+ +``` + +### keywords + CEIL diff --git a/docs/sql-manual/sql-functions/math-functions/cos.md b/docs/sql-manual/sql-functions/math-functions/cos.md new file mode 100644 index 00000000000..3271bd3f23c --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/cos.md @@ -0,0 +1,57 @@ +--- +{ + "title": "cos", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## cos + +### description +#### Syntax + +`DOUBLE cos(DOUBLE x)` +Returns the cosine of `x`, where `x` is in radians + +### example + +``` +mysql> select cos(1); ++---------------------+ +| cos(1.0) | ++---------------------+ +| 0.54030230586813977 | ++---------------------+ +mysql> select cos(0); ++----------+ +| cos(0.0) | ++----------+ +| 1 | ++----------+ +mysql> select cos(Pi()); ++-----------+ +| cos(pi()) | ++-----------+ +| -1 | ++-----------+ +``` + +### keywords + COS diff --git a/docs/sql-manual/sql-functions/math-functions/degrees.md b/docs/sql-manual/sql-functions/math-functions/degrees.md new file mode 100644 index 00000000000..97bd537ba04 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/degrees.md @@ -0,0 +1,57 @@ +--- +{ + "title": "degrees", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## degrees + +### description +#### Syntax + +`DOUBLE degrees(DOUBLE x)` +Returns the degree of `x`, converted from radians to degrees. + +### example + +``` +mysql> select degrees(0); ++--------------+ +| degrees(0.0) | ++--------------+ +| 0 | ++--------------+ +mysql> select degrees(2); ++--------------------+ +| degrees(2.0) | ++--------------------+ +| 114.59155902616465 | ++--------------------+ +mysql> select degrees(Pi()); ++---------------+ +| degrees(pi()) | ++---------------+ +| 180 | ++---------------+ +``` + +### keywords + DEGREES diff --git a/docs/sql-manual/sql-functions/math-functions/e.md b/docs/sql-manual/sql-functions/math-functions/e.md new file mode 100644 index 00000000000..4031787af0c --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/e.md @@ -0,0 +1,45 @@ +--- +{ + "title": "e", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## e + +### description +#### Syntax + +`DOUBLE e()` +Returns the constant `e` value. + +### example + +``` +mysql> select e(); ++--------------------+ +| e() | ++--------------------+ +| 2.7182818284590451 | ++--------------------+ +``` + +### keywords + E diff --git a/docs/sql-manual/sql-functions/math-functions/exp.md b/docs/sql-manual/sql-functions/math-functions/exp.md new file mode 100644 index 00000000000..d7d94ca0599 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/exp.md @@ -0,0 +1,51 @@ +--- +{ + "title": "exp", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## exp + +### description +#### Syntax + +`DOUBLE exp(DOUBLE x)` +Returns `x` raised to the base `e`. + +### example + +``` +mysql> select exp(2); ++------------------+ +| exp(2.0) | ++------------------+ +| 7.38905609893065 | ++------------------+ +mysql> select exp(3.4); ++--------------------+ +| exp(3.4) | ++--------------------+ +| 29.964100047397011 | ++--------------------+ +``` + +### keywords + EXP diff --git a/docs/sql-manual/sql-functions/math-functions/floor.md b/docs/sql-manual/sql-functions/math-functions/floor.md new file mode 100644 index 00000000000..6f9429d3623 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/floor.md @@ -0,0 +1,57 @@ +--- +{ + "title": "floor", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## floor + +### description +#### Syntax + +`BIGINT floor(DOUBLE x)` +Returns the largest integer value less than or equal to `x`. + +### example + +``` +mysql> select floor(1); ++------------+ +| floor(1.0) | ++------------+ +| 1 | ++------------+ +mysql> select floor(2.4); ++------------+ +| floor(2.4) | ++------------+ +| 2 | ++------------+ +mysql> select floor(-10.3); ++--------------+ +| floor(-10.3) | ++--------------+ +| -11 | ++--------------+ +``` + +### keywords + FLOOR diff --git a/docs/sql-manual/sql-functions/math-functions/greatest.md b/docs/sql-manual/sql-functions/math-functions/greatest.md new file mode 100644 index 00000000000..6d50a56263f --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/greatest.md @@ -0,0 +1,66 @@ +--- +{ + "title": "greatest", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## greatest + +### description +#### Syntax + +`greatest(col_a, col_b, …, col_n)` + +`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL` + +Compares the size of `n columns` and returns the largest among them. If there is `NULL` in `column`, it returns `NULL`. + +### example + +``` +mysql> select greatest(-1, 0, 5, 8); ++-----------------------+ +| greatest(-1, 0, 5, 8) | ++-----------------------+ +| 8 | ++-----------------------+ +mysql> select greatest(-1, 0, 5, NULL); ++--------------------------+ +| greatest(-1, 0, 5, NULL) | ++--------------------------+ +| NULL | ++--------------------------+ +mysql> select 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"); ++-------------------------------------------------------------------------------+ +| 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 diff --git a/docs/sql-manual/sql-functions/math-functions/least.md b/docs/sql-manual/sql-functions/math-functions/least.md new file mode 100644 index 00000000000..b1c67bcc723 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/least.md @@ -0,0 +1,66 @@ +--- +{ + "title": "least", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## least + +### description +#### Syntax + +`least(col_a, col_b, …, col_n)` + +`column` supports the following types: `TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL` + +Compare the size of `n columns` and return the smallest among them. If there is `NULL` in `column`, return `NULL`. + +### example + +``` +mysql> select least(-1, 0, 5, 8); ++--------------------+ +| least(-1, 0, 5, 8) | ++--------------------+ +| -1 | ++--------------------+ +mysql> select least(-1, 0, 5, NULL); ++-----------------------+ +| least(-1, 0, 5, NULL) | ++-----------------------+ +| NULL | ++-----------------------+ +mysql> select 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"); ++----------------------------------------------------------------------------+ +| 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 diff --git a/docs/sql-manual/sql-functions/math-functions/ln.md b/docs/sql-manual/sql-functions/math-functions/ln.md new file mode 100644 index 00000000000..ddc8423e4db --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/ln.md @@ -0,0 +1,57 @@ +--- +{ + "title": "ln", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## ln + +### description +#### Syntax + +`DOUBLE ln(DOUBLE x)` +Returns the natural logarithm of `x` to base `e`. + +### example + +``` +mysql> select ln(1); ++---------+ +| ln(1.0) | ++---------+ +| 0 | ++---------+ +mysql> select ln(e()); ++---------+ +| ln(e()) | ++---------+ +| 1 | ++---------+ +mysql> select ln(10); ++--------------------+ +| ln(10.0) | ++--------------------+ +| 2.3025850929940459 | ++--------------------+ +``` + +### keywords + LN diff --git a/docs/sql-manual/sql-functions/math-functions/log.md b/docs/sql-manual/sql-functions/math-functions/log.md new file mode 100644 index 00000000000..98af4cfe78a --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/log.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log + +### description +#### Syntax + +`DOUBLE log(DOUBLE b, DOUBLE x)` +Returns the logarithm of `x` based on base `b`. + +### example + +``` +mysql> select log(5,1); ++---------------+ +| log(5.0, 1.0) | ++---------------+ +| 0 | ++---------------+ +mysql> select log(3,20); ++--------------------+ +| log(3.0, 20.0) | ++--------------------+ +| 2.7268330278608417 | ++--------------------+ +mysql> select log(2,65536); ++-------------------+ +| log(2.0, 65536.0) | ++-------------------+ +| 16 | ++-------------------+ +``` + +### keywords + LOG diff --git a/docs/sql-manual/sql-functions/math-functions/log10.md b/docs/sql-manual/sql-functions/math-functions/log10.md new file mode 100644 index 00000000000..d10075bbcb6 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/log10.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log10", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log10 + +### description +#### Syntax + +`DOUBLE log10(DOUBLE x)` +Returns the natural logarithm of `x` to base `10`. + +### example + +``` +mysql> select log10(1); ++------------+ +| log10(1.0) | ++------------+ +| 0 | ++------------+ +mysql> select log10(10); ++-------------+ +| log10(10.0) | ++-------------+ +| 1 | ++-------------+ +mysql> select log10(16); ++--------------------+ +| log10(16.0) | ++--------------------+ +| 1.2041199826559248 | ++--------------------+ +``` + +### keywords + LOG10 diff --git a/docs/sql-manual/sql-functions/math-functions/log2.md b/docs/sql-manual/sql-functions/math-functions/log2.md new file mode 100644 index 00000000000..43179f969e8 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/log2.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log2", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log2 + +### description +#### Syntax + +`DOUBLE log2(DOUBLE x)` +Returns the natural logarithm of `x` to base `2`. + +### example + +``` +mysql> select log2(1); ++-----------+ +| log2(1.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select log2(2); ++-----------+ +| log2(2.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select log2(10); ++--------------------+ +| log2(10.0) | ++--------------------+ +| 3.3219280948873622 | ++--------------------+ +``` + +### keywords + LOG2 diff --git a/docs/sql-manual/sql-functions/math-functions/negative.md b/docs/sql-manual/sql-functions/math-functions/negative.md new file mode 100644 index 00000000000..908b39228a6 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/negative.md @@ -0,0 +1,51 @@ +--- +{ + "title": "negative", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## negative + +### description +#### Syntax + +`BIGINT negative(BIGINT x)` `DOUBLE negative(DOUBLE x)` `DECIMAL negative(DECIMAL x)` +Return `-x`. + +### example + +``` +mysql> SELECT negative(-10); ++---------------+ +| negative(-10) | ++---------------+ +| 10 | ++---------------+ +mysql> SELECT negative(12); ++--------------+ +| negative(12) | ++--------------+ +| -12 | ++--------------+ +``` + +### keywords + NEGATIVE diff --git a/docs/sql-manual/sql-functions/math-functions/pi.md b/docs/sql-manual/sql-functions/math-functions/pi.md new file mode 100644 index 00000000000..8c9dfd8ee8f --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/pi.md @@ -0,0 +1,45 @@ +--- +{ + "title": "Pi", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## Pi + +### description +#### Syntax + +`DOUBLE Pi()` +Returns the constant `Pi` value. + +### example + +``` +mysql> select Pi(); ++--------------------+ +| pi() | ++--------------------+ +| 3.1415926535897931 | ++--------------------+ +``` + +### keywords + PI diff --git a/docs/sql-manual/sql-functions/math-functions/positive.md b/docs/sql-manual/sql-functions/math-functions/positive.md new file mode 100644 index 00000000000..33a1c7298b3 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/positive.md @@ -0,0 +1,51 @@ +--- +{ + "title": "positive", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## positive + +### description +#### Syntax + +`BIGINT positive(BIGINT x)` `DOUBLE positive(DOUBLE x)` `DECIMAL positive(DECIMAL x)` +Return `x`. + +### example + +``` +mysql> SELECT positive(-10); ++---------------+ +| positive(-10) | ++---------------+ +| -10 | ++---------------+ +mysql> SELECT positive(12); ++--------------+ +| positive(12) | ++--------------+ +| 12 | ++--------------+ +``` + +### keywords + POSITIVE diff --git a/docs/sql-manual/sql-functions/math-functions/pow.md b/docs/sql-manual/sql-functions/math-functions/pow.md new file mode 100644 index 00000000000..9ce0e5cf08d --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/pow.md @@ -0,0 +1,57 @@ +--- +{ + "title": "pow", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## pow + +### description +#### Syntax + +`DOUBLE pow(DOUBLE a, DOUBLE b)` +Returns `a` raised to the `b` power. + +### example + +``` +mysql> select pow(2,0); ++---------------+ +| pow(2.0, 0.0) | ++---------------+ +| 1 | ++---------------+ +mysql> select pow(2,3); ++---------------+ +| pow(2.0, 3.0) | ++---------------+ +| 8 | ++---------------+ +mysql> select pow(3,2.4); ++--------------------+ +| pow(3.0, 2.4) | ++--------------------+ +| 13.966610165238235 | ++--------------------+ +``` + +### keywords + POW diff --git a/docs/sql-manual/sql-functions/math-functions/radians.md b/docs/sql-manual/sql-functions/math-functions/radians.md new file mode 100644 index 00000000000..c11ee2614e8 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/radians.md @@ -0,0 +1,57 @@ +--- +{ + "title": "radians", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## radians + +### description +#### Syntax + +`DOUBLE radians(DOUBLE x)` +Returns the value of `x` in radians, converted from degrees to radians. + +### example + +``` +mysql> select radians(0); ++--------------+ +| radians(0.0) | ++--------------+ +| 0 | ++--------------+ +mysql> select radians(30); ++---------------------+ +| radians(30.0) | ++---------------------+ +| 0.52359877559829882 | ++---------------------+ +mysql> select radians(90); ++--------------------+ +| radians(90.0) | ++--------------------+ +| 1.5707963267948966 | ++--------------------+ +``` + +### keywords + RADIANS diff --git a/docs/sql-manual/sql-functions/math-functions/round.md b/docs/sql-manual/sql-functions/math-functions/round.md new file mode 100644 index 00000000000..8ec4fadc26e --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/round.md @@ -0,0 +1,63 @@ +--- +{ + "title": "round", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## round + +### description +#### Syntax + +`BIGINT round(DOUBLE x)` +Preserve the integer part after rounding `x` + +### example + +``` +mysql> select round(2.4); ++------------+ +| round(2.4) | ++------------+ +| 2 | ++------------+ +mysql> select round(2.5); ++------------+ +| round(2.5) | ++------------+ +| 3 | ++------------+ +mysql> select round(-3.4); ++-------------+ +| round(-3.4) | ++-------------+ +| -3 | ++-------------+ +mysql> select round(-3.5); ++-------------+ +| round(-3.5) | ++-------------+ +| -4 | ++-------------+ +``` + +### keywords + ROUND diff --git a/docs/sql-manual/sql-functions/math-functions/sign.md b/docs/sql-manual/sql-functions/math-functions/sign.md new file mode 100644 index 00000000000..905b257d0c4 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/sign.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sign", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sign + +### description +#### Syntax + +`TINYINT sign(DOUBLE x)` +Returns the sign of `x`. Negative, zero or positive numbers correspond to -1, 0 or 1 respectively. + +### example + +``` +mysql> select sign(3); ++-----------+ +| sign(3.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select sign(0); ++-----------+ +| sign(0.0) | ++-----------+ +| 0 | +mysql> select sign(-10.0); ++-------------+ +| sign(-10.0) | ++-------------+ +| -1 | ++-------------+ +1 row in set (0.01 sec) +``` + +### keywords + SIGN diff --git a/docs/sql-manual/sql-functions/math-functions/sin.md b/docs/sql-manual/sql-functions/math-functions/sin.md new file mode 100644 index 00000000000..0a735b020d7 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/sin.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sin", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sin + +### description +#### Syntax + +`DOUBLE sin(DOUBLE x)` +Returns the sine of `x`, where `x` is in radians + +### example + +``` +mysql> select sin(0); ++----------+ +| sin(0.0) | ++----------+ +| 0 | ++----------+ +mysql> select sin(1); ++--------------------+ +| sin(1.0) | ++--------------------+ +| 0.8414709848078965 | ++--------------------+ +mysql> select sin(0.5 * Pi()); ++-----------------+ +| sin(0.5 * pi()) | ++-----------------+ +| 1 | ++-----------------+ +``` + +### keywords + SIN diff --git a/docs/sql-manual/sql-functions/math-functions/sqrt.md b/docs/sql-manual/sql-functions/math-functions/sqrt.md new file mode 100644 index 00000000000..129dc51debc --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/sqrt.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sqrt", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sqrt + +### description +#### Syntax + +`DOUBLE sqrt(DOUBLE x)` +Returns the square root of `x`. + +### example + +``` +mysql> select sqrt(9); ++-----------+ +| sqrt(9.0) | ++-----------+ +| 3 | ++-----------+ +mysql> select sqrt(2); ++--------------------+ +| sqrt(2.0) | ++--------------------+ +| 1.4142135623730951 | ++--------------------+ +mysql> select sqrt(100.0); ++-------------+ +| sqrt(100.0) | ++-------------+ +| 10 | ++-------------+ +``` + +### keywords + SQRT diff --git a/docs/sql-manual/sql-functions/math-functions/tan.md b/docs/sql-manual/sql-functions/math-functions/tan.md new file mode 100644 index 00000000000..2a1e14a80d0 --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/tan.md @@ -0,0 +1,51 @@ +--- +{ + "title": "tan", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## tan + +### description +#### Syntax + +`DOUBLE tan(DOUBLE x)` +Returns the tangent of `x`, where `x` is in radians. + +### example + +``` +mysql> select tan(0); ++----------+ +| tan(0.0) | ++----------+ +| 0 | ++----------+ +mysql> select tan(1); ++--------------------+ +| tan(1.0) | ++--------------------+ +| 1.5574077246549023 | ++--------------------+ +``` + +### keywords + TAN diff --git a/docs/sql-manual/sql-functions/math-functions/truncate.md b/docs/sql-manual/sql-functions/math-functions/truncate.md new file mode 100644 index 00000000000..1ab6062bfba --- /dev/null +++ b/docs/sql-manual/sql-functions/math-functions/truncate.md @@ -0,0 +1,62 @@ +--- +{ + "title": "truncate", + "language": "en" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## truncate + +### description +#### Syntax + +`DOUBLE truncate(DOUBLE x, INT d)` +Numerically truncate `x` according to the number of decimal places `d`. + +The rules are as follows: +When `d > 0`: keep `d` decimal places of `x` +When `d = 0`: remove the fractional part of `x` and keep only the integer part +When `d < 0`: Remove the fractional part of `x`, and replace the integer part with the number `0` according to the number of digits specified by `d` + +### example + +``` +mysql> select truncate(124.3867, 2); ++-----------------------+ +| truncate(124.3867, 2) | ++-----------------------+ +| 124.38 | ++-----------------------+ +mysql> select truncate(124.3867, 0); ++-----------------------+ +| truncate(124.3867, 0) | ++-----------------------+ +| 124 | ++-----------------------+ +mysql> select truncate(-124.3867, -2); ++-------------------------+ +| truncate(-124.3867, -2) | ++-------------------------+ +| -100 | ++-------------------------+ +``` + +### keywords + TRUNCATE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/abs.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/abs.md new file mode 100644 index 00000000000..383cf9fadbe --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/abs.md @@ -0,0 +1,62 @@ +--- +{ + "title": "abs", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## abs + +### description +#### Syntax + +`DOUBLE abs(DOUBLE x)` `SMALLINT abs(TINYINT x)` `INT abs(SMALLINT x)` + +`BIGINT abs(INT x)` `LARGEINT abs(BIGINT x)` `LARGEINT abs(LARGEINT x)` + +`DOUBLE abs(DOUBLE x)` `FLOAT abs(FLOAT x)` `DECIMAL abs(DECIMAL x)` + +返回`x`的绝对值. + +### example + +``` +mysql> select abs(-2); ++---------+ +| abs(-2) | ++---------+ +| 2 | ++---------+ +mysql> select abs(3.254655654); ++------------------+ +| abs(3.254655654) | ++------------------+ +| 3.254655654 | ++------------------+ +mysql> select abs(-3254654236547654354654767); ++---------------------------------+ +| abs(-3254654236547654354654767) | ++---------------------------------+ +| 3254654236547654354654767 | ++---------------------------------+ +``` + +### keywords + ABS diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/acos.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/acos.md new file mode 100644 index 00000000000..5a7adb38f81 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/acos.md @@ -0,0 +1,57 @@ +--- +{ + "title": "acos", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## acos + +### description +#### Syntax + +`DOUBLE acos(DOUBLE x)` +返回`x`的反余弦值,若 `x`不在`-1`到 `1`的范围之内,则返回 `nan`. + +### example + +``` +mysql> select acos(1); ++-----------+ +| acos(1.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select acos(0); ++--------------------+ +| acos(0.0) | ++--------------------+ +| 1.5707963267948966 | ++--------------------+ +mysql> select acos(-2); ++------------+ +| acos(-2.0) | ++------------+ +| nan | ++------------+ +``` + +### keywords + ACOS diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/asin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/asin.md new file mode 100644 index 00000000000..ef12d69298d --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/asin.md @@ -0,0 +1,51 @@ +--- +{ + "title": "asin", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## asin + +### description +#### Syntax + +`DOUBLE asin(DOUBLE x)` +返回`x`的反正弦值,若 `x`不在`-1`到 `1`的范围之内,则返回 `nan`. + +### example + +``` +mysql> select asin(0.5); ++---------------------+ +| asin(0.5) | ++---------------------+ +| 0.52359877559829893 | ++---------------------+ +mysql> select asin(2); ++-----------+ +| asin(2.0) | ++-----------+ +| nan | ++-----------+ +``` + +### keywords + ASIN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/atan.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/atan.md new file mode 100644 index 00000000000..0167db4ebf3 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/atan.md @@ -0,0 +1,51 @@ +--- +{ + "title": "atan", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## atan + +### description +#### Syntax + +`DOUBLE atan(DOUBLE x)` +返回`x`的反正切值,`x`为弧度值. + +### example + +``` +mysql> select atan(0); ++-----------+ +| atan(0.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select atan(2); ++--------------------+ +| atan(2.0) | ++--------------------+ +| 1.1071487177940904 | ++--------------------+ +``` + +### keywords + ATAN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/bin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/bin.md new file mode 100644 index 00000000000..b387fc71577 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/bin.md @@ -0,0 +1,57 @@ +--- +{ + "title": "bin", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## bin + +### description +#### Syntax + +`STRING bin(BIGINT x)` +将十进制数`x`转换为二进制数. + +### example + +``` +mysql> select bin(0); ++--------+ +| bin(0) | ++--------+ +| 0 | ++--------+ +mysql> select bin(10); ++---------+ +| bin(10) | ++---------+ +| 1010 | ++---------+ +mysql> select bin(-3); ++------------------------------------------------------------------+ +| bin(-3) | ++------------------------------------------------------------------+ +| 1111111111111111111111111111111111111111111111111111111111111101 | ++------------------------------------------------------------------+ +``` + +### keywords + BIN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ceil.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ceil.md new file mode 100644 index 00000000000..ded81b27dd5 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ceil.md @@ -0,0 +1,57 @@ +--- +{ + "title": "ceil", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## ceil + +### description +#### Syntax + +`BIGINT ceil(DOUBLE x)` +返回大于或等于`x`的最小整数值. + +### example + +``` +mysql> select ceil(1); ++-----------+ +| ceil(1.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select ceil(2.4); ++-----------+ +| ceil(2.4) | ++-----------+ +| 3 | ++-----------+ +mysql> select ceil(-10.3); ++-------------+ +| ceil(-10.3) | ++-------------+ +| -10 | ++-------------+ +``` + +### keywords + CEIL diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/cos.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/cos.md new file mode 100644 index 00000000000..3cb8f9f06a4 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/cos.md @@ -0,0 +1,57 @@ +--- +{ + "title": "cos", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## cos + +### description +#### Syntax + +`DOUBLE cos(DOUBLE x)` +返回`x`的余弦值,`x` 为弧度值. + +### example + +``` +mysql> select cos(1); ++---------------------+ +| cos(1.0) | ++---------------------+ +| 0.54030230586813977 | ++---------------------+ +mysql> select cos(0); ++----------+ +| cos(0.0) | ++----------+ +| 1 | ++----------+ +mysql> select cos(Pi()); ++-----------+ +| cos(pi()) | ++-----------+ +| -1 | ++-----------+ +``` + +### keywords + COS diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/degrees.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/degrees.md new file mode 100644 index 00000000000..84ba74f0a60 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/degrees.md @@ -0,0 +1,57 @@ +--- +{ + "title": "degrees", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## degrees + +### description +#### Syntax + +`DOUBLE degrees(DOUBLE x)` +返回`x`的度, 从弧度转换为度. + +### example + +``` +mysql> select degrees(0); ++--------------+ +| degrees(0.0) | ++--------------+ +| 0 | ++--------------+ +mysql> select degrees(2); ++--------------------+ +| degrees(2.0) | ++--------------------+ +| 114.59155902616465 | ++--------------------+ +mysql> select degrees(Pi()); ++---------------+ +| degrees(pi()) | ++---------------+ +| 180 | ++---------------+ +``` + +### keywords + DEGREES diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/e.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/e.md new file mode 100644 index 00000000000..4b1eaf241c0 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/e.md @@ -0,0 +1,45 @@ +--- +{ + "title": "e", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## e + +### description +#### Syntax + +`DOUBLE e()` +返回常量`e`值. + +### example + +``` +mysql> select e(); ++--------------------+ +| e() | ++--------------------+ +| 2.7182818284590451 | ++--------------------+ +``` + +### keywords + E diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/exp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/exp.md new file mode 100644 index 00000000000..ffc31668cc7 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/exp.md @@ -0,0 +1,51 @@ +--- +{ + "title": "exp", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## exp + +### description +#### Syntax + +`DOUBLE exp(DOUBLE x)` +返回以`e`为底的`x`的幂. + +### example + +``` +mysql> select exp(2); ++------------------+ +| exp(2.0) | ++------------------+ +| 7.38905609893065 | ++------------------+ +mysql> select exp(3.4); ++--------------------+ +| exp(3.4) | ++--------------------+ +| 29.964100047397011 | ++--------------------+ +``` + +### keywords + EXP diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/floor.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/floor.md new file mode 100644 index 00000000000..3d3fa7fd864 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/floor.md @@ -0,0 +1,57 @@ +--- +{ + "title": "floor", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## floor + +### description +#### Syntax + +`BIGINT floor(DOUBLE x)` +返回小于或等于`x`的最大整数值. + +### example + +``` +mysql> select floor(1); ++------------+ +| floor(1.0) | ++------------+ +| 1 | ++------------+ +mysql> select floor(2.4); ++------------+ +| floor(2.4) | ++------------+ +| 2 | ++------------+ +mysql> select floor(-10.3); ++--------------+ +| floor(-10.3) | ++--------------+ +| -11 | ++--------------+ +``` + +### keywords + FLOOR diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/greatest.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/greatest.md new file mode 100644 index 00000000000..ea07fbdb1e7 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/greatest.md @@ -0,0 +1,66 @@ +--- +{ + "title": "greatest", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## greatest + +### description +#### Syntax + +`greatest(col_a, col_b, …, col_n)` + +`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL` + +比较`n`个`column`的大小返回其中的最大值.若`column`中有`NULL`,则返回`NULL`. + +### example + +``` +mysql> select greatest(-1, 0, 5, 8); ++-----------------------+ +| greatest(-1, 0, 5, 8) | ++-----------------------+ +| 8 | ++-----------------------+ +mysql> select greatest(-1, 0, 5, NULL); ++--------------------------+ +| greatest(-1, 0, 5, NULL) | ++--------------------------+ +| NULL | ++--------------------------+ +mysql> select 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"); ++-------------------------------------------------------------------------------+ +| 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 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/least.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/least.md new file mode 100644 index 00000000000..c66087f5fae --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/least.md @@ -0,0 +1,66 @@ +--- +{ + "title": "least", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## least + +### description +#### Syntax + +`least(col_a, col_b, …, col_n)` + +`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `STRING` `DATETIME` `DECIMAL` + +比较`n`个`column`的大小返回其中的最小值.若`column`中有`NULL`,则返回`NULL`. + +### example + +``` +mysql> select least(-1, 0, 5, 8); ++--------------------+ +| least(-1, 0, 5, 8) | ++--------------------+ +| -1 | ++--------------------+ +mysql> select least(-1, 0, 5, NULL); ++-----------------------+ +| least(-1, 0, 5, NULL) | ++-----------------------+ +| NULL | ++-----------------------+ +mysql> select 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"); ++----------------------------------------------------------------------------+ +| 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 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ln.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ln.md new file mode 100644 index 00000000000..2a1d194f4b7 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/ln.md @@ -0,0 +1,57 @@ +--- +{ + "title": "ln", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## ln + +### description +#### Syntax + +`DOUBLE ln(DOUBLE x)` +返回以`e`为底的`x`的自然对数. + +### example + +``` +mysql> select ln(1); ++---------+ +| ln(1.0) | ++---------+ +| 0 | ++---------+ +mysql> select ln(e()); ++---------+ +| ln(e()) | ++---------+ +| 1 | ++---------+ +mysql> select ln(10); ++--------------------+ +| ln(10.0) | ++--------------------+ +| 2.3025850929940459 | ++--------------------+ +``` + +### keywords + LN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log.md new file mode 100644 index 00000000000..80c42fc9c45 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log + +### description +#### Syntax + +`DOUBLE log(DOUBLE b, DOUBLE x)` +返回基于底数`b`的`x`的对数. + +### example + +``` +mysql> select log(5,1); ++---------------+ +| log(5.0, 1.0) | ++---------------+ +| 0 | ++---------------+ +mysql> select log(3,20); ++--------------------+ +| log(3.0, 20.0) | ++--------------------+ +| 2.7268330278608417 | ++--------------------+ +mysql> select log(2,65536); ++-------------------+ +| log(2.0, 65536.0) | ++-------------------+ +| 16 | ++-------------------+ +``` + +### keywords + LOG diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log10.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log10.md new file mode 100644 index 00000000000..34d56c36073 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log10.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log10", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log10 + +### description +#### Syntax + +`DOUBLE log10(DOUBLE x)` +返回以`10`为底的`x`的自然对数. + +### example + +``` +mysql> select log10(1); ++------------+ +| log10(1.0) | ++------------+ +| 0 | ++------------+ +mysql> select log10(10); ++-------------+ +| log10(10.0) | ++-------------+ +| 1 | ++-------------+ +mysql> select log10(16); ++--------------------+ +| log10(16.0) | ++--------------------+ +| 1.2041199826559248 | ++--------------------+ +``` + +### keywords + LOG10 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log2.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log2.md new file mode 100644 index 00000000000..6b41b317fcd --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/log2.md @@ -0,0 +1,57 @@ +--- +{ + "title": "log2", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## log2 + +### description +#### Syntax + +`DOUBLE log2(DOUBLE x)` +返回以`2`为底的`x`的自然对数. + +### example + +``` +mysql> select log2(1); ++-----------+ +| log2(1.0) | ++-----------+ +| 0 | ++-----------+ +mysql> select log2(2); ++-----------+ +| log2(2.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select log2(10); ++--------------------+ +| log2(10.0) | ++--------------------+ +| 3.3219280948873622 | ++--------------------+ +``` + +### keywords + LOG2 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/negative.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/negative.md new file mode 100644 index 00000000000..e0e05021ada --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/negative.md @@ -0,0 +1,51 @@ +--- +{ + "title": "negative", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## negative + +### description +#### Syntax + +`BIGINT negative(BIGINT x)` `DOUBLE negative(DOUBLE x)` `DECIMAL negative(DECIMAL x)` +返回`-x`. + +### example + +``` +mysql> SELECT negative(-10); ++---------------+ +| negative(-10) | ++---------------+ +| 10 | ++---------------+ +mysql> SELECT negative(12); ++--------------+ +| negative(12) | ++--------------+ +| -12 | ++--------------+ +``` + +### keywords + NEGATIVE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pi.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pi.md new file mode 100644 index 00000000000..78fe1e6f110 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pi.md @@ -0,0 +1,45 @@ +--- +{ + "title": "Pi", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## Pi + +### description +#### Syntax + +`DOUBLE Pi()` +返回常量`Pi`值. + +### example + +``` +mysql> select Pi(); ++--------------------+ +| pi() | ++--------------------+ +| 3.1415926535897931 | ++--------------------+ +``` + +### keywords + PI diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/positive.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/positive.md new file mode 100644 index 00000000000..0c8bf74b1f5 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/positive.md @@ -0,0 +1,51 @@ +--- +{ + "title": "positive", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## positive + +### description +#### Syntax + +`BIGINT positive(BIGINT x)` `DOUBLE positive(DOUBLE x)` `DECIMAL positive(DECIMAL x)` +返回`x`. + +### example + +``` +mysql> SELECT positive(-10); ++---------------+ +| positive(-10) | ++---------------+ +| -10 | ++---------------+ +mysql> SELECT positive(12); ++--------------+ +| positive(12) | ++--------------+ +| 12 | ++--------------+ +``` + +### keywords + POSITIVE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pow.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pow.md new file mode 100644 index 00000000000..3b4fdbb268d --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/pow.md @@ -0,0 +1,57 @@ +--- +{ + "title": "pow", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## pow + +### description +#### Syntax + +`DOUBLE pow(DOUBLE a, DOUBLE b)` +返回`a`的`b`次方. + +### example + +``` +mysql> select pow(2,0); ++---------------+ +| pow(2.0, 0.0) | ++---------------+ +| 1 | ++---------------+ +mysql> select pow(2,3); ++---------------+ +| pow(2.0, 3.0) | ++---------------+ +| 8 | ++---------------+ +mysql> select pow(3,2.4); ++--------------------+ +| pow(3.0, 2.4) | ++--------------------+ +| 13.966610165238235 | ++--------------------+ +``` + +### keywords + POW diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/radians.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/radians.md new file mode 100644 index 00000000000..2508190caeb --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/radians.md @@ -0,0 +1,57 @@ +--- +{ + "title": "radians", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## radians + +### description +#### Syntax + +`DOUBLE radians(DOUBLE x)` +返回`x`的弧度值, 从度转换为弧度. + +### example + +``` +mysql> select radians(0); ++--------------+ +| radians(0.0) | ++--------------+ +| 0 | ++--------------+ +mysql> select radians(30); ++---------------------+ +| radians(30.0) | ++---------------------+ +| 0.52359877559829882 | ++---------------------+ +mysql> select radians(90); ++--------------------+ +| radians(90.0) | ++--------------------+ +| 1.5707963267948966 | ++--------------------+ +``` + +### keywords + RADIANS diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/round.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/round.md new file mode 100644 index 00000000000..f6556ffc816 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/round.md @@ -0,0 +1,63 @@ +--- +{ + "title": "round", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## round + +### description +#### Syntax + +`BIGINT round(DOUBLE x)` +将`x`四舍五入后保留整数部分. + +### example + +``` +mysql> select round(2.4); ++------------+ +| round(2.4) | ++------------+ +| 2 | ++------------+ +mysql> select round(2.5); ++------------+ +| round(2.5) | ++------------+ +| 3 | ++------------+ +mysql> select round(-3.4); ++-------------+ +| round(-3.4) | ++-------------+ +| -3 | ++-------------+ +mysql> select round(-3.5); ++-------------+ +| round(-3.5) | ++-------------+ +| -4 | ++-------------+ +``` + +### keywords + ROUND diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sign.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sign.md new file mode 100644 index 00000000000..e98f7cba192 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sign.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sign", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sign + +### description +#### Syntax + +`TINYINT sign(DOUBLE x)` +返回`x`的符号.负数,零或正数分别对应-1,0或1. + +### example + +``` +mysql> select sign(3); ++-----------+ +| sign(3.0) | ++-----------+ +| 1 | ++-----------+ +mysql> select sign(0); ++-----------+ +| sign(0.0) | ++-----------+ +| 0 | +mysql> select sign(-10.0); ++-------------+ +| sign(-10.0) | ++-------------+ +| -1 | ++-------------+ +1 row in set (0.01 sec) +``` + +### keywords + SIGN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sin.md new file mode 100644 index 00000000000..f33fa9324d7 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sin.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sin", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sin + +### description +#### Syntax + +`DOUBLE sin(DOUBLE x)` +返回`x`的正弦值,`x` 为弧度值. + +### example + +``` +mysql> select sin(0); ++----------+ +| sin(0.0) | ++----------+ +| 0 | ++----------+ +mysql> select sin(1); ++--------------------+ +| sin(1.0) | ++--------------------+ +| 0.8414709848078965 | ++--------------------+ +mysql> select sin(0.5 * Pi()); ++-----------------+ +| sin(0.5 * pi()) | ++-----------------+ +| 1 | ++-----------------+ +``` + +### keywords + SIN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sqrt.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sqrt.md new file mode 100644 index 00000000000..0b29b5a5416 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/sqrt.md @@ -0,0 +1,57 @@ +--- +{ + "title": "sqrt", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## sqrt + +### description +#### Syntax + +`DOUBLE sqrt(DOUBLE x)` +返回`x`的平方根. + +### example + +``` +mysql> select sqrt(9); ++-----------+ +| sqrt(9.0) | ++-----------+ +| 3 | ++-----------+ +mysql> select sqrt(2); ++--------------------+ +| sqrt(2.0) | ++--------------------+ +| 1.4142135623730951 | ++--------------------+ +mysql> select sqrt(100.0); ++-------------+ +| sqrt(100.0) | ++-------------+ +| 10 | ++-------------+ +``` + +### keywords + SQRT diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/tan.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/tan.md new file mode 100644 index 00000000000..8f843262ed4 --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/tan.md @@ -0,0 +1,51 @@ +--- +{ + "title": "tan", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## tan + +### description +#### Syntax + +`DOUBLE tan(DOUBLE x)` +返回`x`的正切值,`x`为弧度值. + +### example + +``` +mysql> select tan(0); ++----------+ +| tan(0.0) | ++----------+ +| 0 | ++----------+ +mysql> select tan(1); ++--------------------+ +| tan(1.0) | ++--------------------+ +| 1.5574077246549023 | ++--------------------+ +``` + +### keywords + TAN diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/truncate.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/truncate.md new file mode 100644 index 00000000000..d435a43280f --- /dev/null +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/math-functions/truncate.md @@ -0,0 +1,62 @@ +--- +{ + "title": "truncate", + "language": "zh-CN" +} +--- + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +## truncate + +### description +#### Syntax + +`DOUBLE truncate(DOUBLE x, INT d)` +按照保留小数的位数`d`对`x`进行数值截取。 + +规则如下: +当`d > 0`时:保留`x`的`d`位小数 +当`d = 0`时:将`x`的小数部分去除,只保留整数部分 +当`d < 0`时:将`x`的小数部分去除,整数部分按照 `d`所指定的位数,采用数字`0`进行替换 + +### example + +``` +mysql> select truncate(124.3867, 2); ++-----------------------+ +| truncate(124.3867, 2) | ++-----------------------+ +| 124.38 | ++-----------------------+ +mysql> select truncate(124.3867, 0); ++-----------------------+ +| truncate(124.3867, 0) | ++-----------------------+ +| 124 | ++-----------------------+ +mysql> select truncate(-124.3867, -2); ++-------------------------+ +| truncate(-124.3867, -2) | ++-------------------------+ +| -100 | ++-------------------------+ +``` + +### keywords + TRUNCATE diff --git a/sidebars.json b/sidebars.json index c2e401b8acb..2459b2bfcd9 100644 --- a/sidebars.json +++ b/sidebars.json @@ -440,7 +440,34 @@ "label": "Math Functions", "items": [ "sql-manual/sql-functions/math-functions/conv", - "sql-manual/sql-functions/math-functions/pmod" + "sql-manual/sql-functions/math-functions/pmod", + "sql-manual/sql-functions/math-functions/abs", + "sql-manual/sql-functions/math-functions/acos", + "sql-manual/sql-functions/math-functions/asin", + "sql-manual/sql-functions/math-functions/atan", + "sql-manual/sql-functions/math-functions/bin", + "sql-manual/sql-functions/math-functions/ceil", + "sql-manual/sql-functions/math-functions/cos", + "sql-manual/sql-functions/math-functions/degrees", + "sql-manual/sql-functions/math-functions/e", + "sql-manual/sql-functions/math-functions/exp", + "sql-manual/sql-functions/math-functions/greatest", + "sql-manual/sql-functions/math-functions/least", + "sql-manual/sql-functions/math-functions/ln", + "sql-manual/sql-functions/math-functions/log", + "sql-manual/sql-functions/math-functions/log10", + "sql-manual/sql-functions/math-functions/log2", + "sql-manual/sql-functions/math-functions/negative", + "sql-manual/sql-functions/math-functions/pi", + "sql-manual/sql-functions/math-functions/positive", + "sql-manual/sql-functions/math-functions/pow", + "sql-manual/sql-functions/math-functions/radians", + "sql-manual/sql-functions/math-functions/round", + "sql-manual/sql-functions/math-functions/sign", + "sql-manual/sql-functions/math-functions/sin", + "sql-manual/sql-functions/math-functions/sqrt", + "sql-manual/sql-functions/math-functions/tan", + "sql-manual/sql-functions/math-functions/truncate" ] }, { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org