/

USAGE

dividend / divisor

Value Name

Description

dividend

The numbers in the division

divisor

The numbers in the division

DETAILS

The / operator divides the dividend by the divisor and returns the floating point result of the division. The / operator is similar to the DIVFLT() function.

A NULL is returned if the divisor is 0 or if either the dividend or divisor is NULL.

Because the returned value is not rounded down, the result of x / y is not the same as FLOOR(x / y) when the resulting value is negative.

To obtain the integer result of a division operation, see "DIV" or "DIVINT()".

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT 12345 / 10, 22 / 3, .5 / .25;
+------------+--------+----------+
| 12345 / 10 | 22 / 3 | .5 / .25 |
+------------+--------+----------+
|  1234.5000 | 7.3333 |  2.00000 |
+------------+--------+----------+
CREATE TABLE div_example (
  val INT
);
INSERT INTO div_example VALUES
  (21), (22), (23), (24), (25), (26), (27), (28),
  (-21), (-22), (-23), (-24), (-25), (-26), (-27), (-28);
SELECT val, val / 7, val DIV 7, FLOOR(val / 7)
FROM div_example;
+------+---------+-----------+----------------+
| val  | val / 7 | val DIV 7 | FLOOR(val / 7) |
+------+---------+-----------+----------------+
|   21 |  3.0000 |         3 |              3 |
|   22 |  3.1429 |         3 |              3 |
|   23 |  3.2857 |         3 |              3 |
|   24 |  3.4286 |         3 |              3 |
|   25 |  3.5714 |         3 |              3 |
|   26 |  3.7143 |         3 |              3 |
|   27 |  3.8571 |         3 |              3 |
|   28 |  4.0000 |         4 |              4 |
|  -21 | -3.0000 |        -3 |             -3 |
|  -22 | -3.1429 |        -3 |             -4 |
|  -23 | -3.2857 |        -3 |             -4 |
|  -24 | -3.4286 |        -3 |             -4 |
|  -25 | -3.5714 |        -3 |             -4 |
|  -26 | -3.7143 |        -3 |             -4 |
|  -27 | -3.8571 |        -3 |             -4 |
|  -28 | -4.0000 |        -4 |             -4 |
+------+---------+-----------+----------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES