MOD

2023-10-31 11:17:12  Updated

Syntax

MOD(N,M)

Purpose

MOD() returns the remainder of a number divided by another number. MOD(N,M), N % M, and N MOD M are equivalent.

MOD() works also for numeric values with a fractional part and returns the exact remainder after the division operation.

If either of N or M is NULL, the return value is NULL. If M is 0, the return value is also NULL.

Examples

obclient> SELECT MOD(29,19), 29 MOD 19, 29 % 19;
+------------+-----------+---------+
| MOD(29,19) | 29 MOD 19 | 29 % 19 |
+------------+-----------+---------+
|         10 |        10 |      10 |
+------------+-----------+---------+
1 row in set

Contact Us