MODULO

All functions > MATH > MODULO

Returns the remainder after dividing the first number by the second (modulo operation).

Signatures

Returns: the remainder of the division

MODULO(dividend: T, divisor: T) → T
sql
ParameterTypeRequiredDescription
dividendTYesNumber to be divided
divisorTYesNumber to divide by (modulus)

Notes

  • Returns the remainder of integer division
  • Sign of result matches the sign of the dividend
  • Returns NULL if either operand is NULL
  • Operator form: dividend % divisor
  • Division by zero results in an error
  • Useful for cycling through values, checking even/odd, etc.

Aliases

  • MOD

See also

Examples

FeatureQL
SELECT
    f1 := MODULO(10, 3),  -- Basic modulo
    f2 := MODULO(15, 4),  -- Another remainder
    f3 := MODULO(7, 7),  -- No remainder
    f4 := MODULO(-10, 3),  -- Negative dividend
    f5 := MODULO(8, 2)  -- Even number check
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINTf5 BIGINT
130-10

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19