Skip to main content

Categories: Math

MOD

Returns the remainder of a division. The result can be negative if the dividend is negative.

Syntax​

MOD(numeric_expression int64, numeric_expression int64) → int64​

  • numeric_expression: The first numeric expression.
  • numeric_expression: The second numeric expression.

Examples

MOD example
SELECT MOD(50, 7)
-- 1
Return NULL for a NULL input
SELECT MOD(NULL, 3)
-- null

MOD(numeric_expression int64, numeric_expression int32) → int32​

  • numeric_expression: The first numeric expression.
  • numeric_expression: The second numeric expression.

Examples

MOD example
SELECT MOD(35, 5)
-- 0

MOD(numeric_expression decimal(0,0), numeric_expression decimal(0,0)) → decimal(0,0)​

  • numeric_expression: The first numeric expression.
  • numeric_expression: The second numeric expression.

Examples

MOD example
SELECT MOD(47.6, 5.2)
-- 0.8