Skip to main content

ARITHMETICS

Examples

MySQL [(none)]> select plus(5, 2);
+------------+
| plus(5, 2) |
+------------+
| 7 |
+------------+

MySQL [(none)]> select minus(5, 2);
+-------------+
| minus(5, 2) |
+-------------+
| 3 |
+-------------+

MySQL [(none)]> select multiply(5, 2);
+----------------+
| multiply(5, 2) |
+----------------+
| 10 |
+----------------+

MySQL [(none)]> select 5 div 2;
+-----------+
| (5 div 2) |
+-----------+
| 2 |
+-----------+

MySQL [(none)]> select div(5, 2);
+-----------+
| div(5, 2) |
+-----------+
| 2 |
+-----------+

MySQL [(none)]> select divide(5, 2);
+--------------+
| divide(5, 2) |
+--------------+
| 2.5 |
+--------------+

MySQL [(none)]> select mod(5, 2);
+-----------+
| mod(5, 2) |
+-----------+
| 1 |
+-----------+

MySQL [(none)]> select modulo(5, 2);
+--------------+
| modulo(5, 2) |
+--------------+
| 1 |
+--------------+

MySQL [(none)]> select negate(10);
+------------+
| negate(10) |
+------------+
| -10 |
+------------+

MySQL [(none)]> select negate(-10);
+-------------+
| negate(-10) |
+-------------+
| 10 |
+-------------+

MySQL [(none)]> select 5 + 2;
+---------+
| (5 + 2) |
+---------+
| 7 |
+---------+

MySQL [(none)]> select 5 - 2;
+---------+
| (5 - 2) |
+---------+
| 3 |
+---------+

MySQL [(none)]> select 5 * 3;
+---------+
| (5 * 3) |
+---------+
| 15 |
+---------+

MySQL [(none)]> select 5 / 2;
+---------+
| (5 / 2) |
+---------+
| 2.5 |
+---------+

MySQL [(none)]> select 5 % 2;
+---------+
| (5 % 2) |
+---------+
| 1 |
+---------+