跳到主要内容
版本: 最新版本-3.5

divide (除法)

Return the quotient of x divide y. If y is 0, return null. (返回x除以y的商。如果y为0,则返回null。)

语法

divide(x, y)

参数

  • x: The supported types are DOUBLE, FLOAT, LARGEINT, BIGINT, INT, SMALLINT, TINYINT, DECIMALV2, DECIMAL32, DECIMAL64, DECIMAL128. (x:支持的类型包括 DOUBLE、FLOAT、LARGEINT、BIGINT、INT、SMALLINT、TINYINT、DECIMALV2、DECIMAL32、DECIMAL64、DECIMAL128。)

  • y: The supported types are the same as x. (y:支持的类型与x相同。)

返回值

返回 DOUBLE 数据类型的值。

使用说明

如果指定非数值,则此函数返回 NULL

示例

mysql> select divide(3, 2);
+--------------+
| divide(3, 2) |
+--------------+
| 1.5 |
+--------------+
1 row in set (0.00 sec)