Skip to main content

MOD

Description​

Find the remainder of a divided by b for the integer type. For the floating-point type, please use the fmod function.

Syntax​

MOD(<col_a> , <col_b>)

Parameters​

ParameterDescription
<col_a>Dividend
<col_b>Divisor should not be 0

Return value​

Return an integer type. Special cases:

If col_a IS NULL or col_b IS NULL, return NULL.

Example​

select mod(10, 3);
+----------+
| (10 % 3) |
+----------+
| 1 |
+----------+
select mod(10, 0);
+----------+
| (10 % 0) |
+----------+
| NULL |
+----------+