Returns the smallest positive solution of the modulo operation x mod y within the modular system, which is obtained by calculating (x % y + y) % y.
PMOD(<x> , <y>)
| Parameter | Description |
|---|---|
<x> | Dividend |
<y> | Divisor should not be 0 |
Returns an integer or a floating-point number. Special cases:
SELECT PMOD(13,5);
+-------------+ | pmod(13, 5) | +-------------+ | 3 | +-------------+
SELECT PMOD(-13,5);
+--------------+ | pmod(-13, 5) | +--------------+ | 2 | +--------------+
SELECT PMOD(0,-12);
+--------------+ | pmod(0, -12) | +--------------+ | 0 | +--------------+
SELECT PMOD(0,null);
+-------------------------------+ | pmod(cast(0 as DOUBLE), NULL) | +-------------------------------+ | NULL | +-------------------------------+