MODULO

All functions > MATH > MODULO

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

Syntax

MODULO(dividend: T, divisor: T) → T
sql

Type Parameters:

  • T: BIGINT or DECIMAL

Arguments

ParameterTypeRequiredDescription
dividendTYesNumber to be divided
divisorTYesNumber to divide by (modulus)

Returns

Same as input type - BIGINT or DECIMAL

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

Last update at: 2025/10/13 10:23:46