MOD

Calculates the remainder after dividing two values, <value_n> / <value_d>.

Syntax

MOD(<value_n>,<value_d>)

Parameters

Parameter Description Supported input types
<value_n> The numerator of the division equation INT, BIGINT
<value_d> The denominator of the division equation INT, BIGINT

Return Type

BIGINT if one of the inputs is BIGINT. INT, otherwise.

Example

The following example returns the remainder of 45 divided by 7:

Interactive SQL Playground 🔥
SELECT MOD(45, 7);