[Docs](fucntion) Add docs for function random, mod, fmod (#14444)
This commit is contained in:
55
docs/en/docs/sql-manual/sql-functions/math-functions/mod.md
Normal file
55
docs/en/docs/sql-manual/sql-functions/math-functions/mod.md
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
{
|
||||
"title": "mod",
|
||||
"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.
|
||||
-->
|
||||
|
||||
## mod
|
||||
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
`mod(col_a, col_b)`
|
||||
|
||||
`column` support type:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `DECIMAL`
|
||||
|
||||
Find the remainder of a/b. For floating-point types, use the fmod function.
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select mod(10, 3);
|
||||
+------------+
|
||||
| mod(10, 3) |
|
||||
+------------+
|
||||
| 1 |
|
||||
+------------+
|
||||
|
||||
mysql> select fmod(10.1, 3.2);
|
||||
+-----------------+
|
||||
| fmod(10.1, 3.2) |
|
||||
+-----------------+
|
||||
| 0.50000024 |
|
||||
+-----------------+
|
||||
```
|
||||
|
||||
### keywords
|
||||
MOD,FMOD
|
||||
@ -0,0 +1,45 @@
|
||||
---
|
||||
{
|
||||
"title": "random",
|
||||
"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.
|
||||
-->
|
||||
|
||||
## random
|
||||
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
`DOUBLE random()`
|
||||
Returns a random number between 0-1.
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select random();
|
||||
+---------------------+
|
||||
| random() |
|
||||
+---------------------+
|
||||
| 0.35446706030596947 |
|
||||
+---------------------+
|
||||
```
|
||||
|
||||
### keywords
|
||||
RANDOM
|
||||
@ -582,7 +582,9 @@
|
||||
"sql-manual/sql-functions/math-functions/positive",
|
||||
"sql-manual/sql-functions/math-functions/negative",
|
||||
"sql-manual/sql-functions/math-functions/greatest",
|
||||
"sql-manual/sql-functions/math-functions/least"
|
||||
"sql-manual/sql-functions/math-functions/least",
|
||||
"sql-manual/sql-functions/math-functions/random",
|
||||
"sql-manual/sql-functions/math-functions/mod"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
---
|
||||
{
|
||||
"title": "mod",
|
||||
"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.
|
||||
-->
|
||||
|
||||
## mod
|
||||
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
`mod(col_a, col_b)`
|
||||
|
||||
`column`支持以下类型:`TINYINT` `SMALLINT` `INT` `BIGINT` `LARGEINT` `FLOAT` `DOUBLE` `DECIMAL`
|
||||
|
||||
求a / b的余数。浮点类型请使用fmod函数。
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select mod(10, 3);
|
||||
+------------+
|
||||
| mod(10, 3) |
|
||||
+------------+
|
||||
| 1 |
|
||||
+------------+
|
||||
|
||||
mysql> select fmod(10.1, 3.2);
|
||||
+-----------------+
|
||||
| fmod(10.1, 3.2) |
|
||||
+-----------------+
|
||||
| 0.50000024 |
|
||||
+-----------------+
|
||||
```
|
||||
|
||||
### keywords
|
||||
MOD,FMOD
|
||||
@ -0,0 +1,45 @@
|
||||
---
|
||||
{
|
||||
"title": "random",
|
||||
"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.
|
||||
-->
|
||||
|
||||
## random
|
||||
|
||||
### description
|
||||
#### Syntax
|
||||
|
||||
`DOUBLE random()`
|
||||
返回0-1的随机数。
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> select random();
|
||||
+---------------------+
|
||||
| random() |
|
||||
+---------------------+
|
||||
| 0.35446706030596947 |
|
||||
+---------------------+
|
||||
```
|
||||
|
||||
### keywords
|
||||
RANDOM
|
||||
Reference in New Issue
Block a user