Returns the remainder of the division of two integer values.

Syntax

MOD(expression1, expression2)

Arguments

expression1, expression2 - a number of SMALLINT, INTEGER, or BIGINT type.

Returns

  • A SMALLINT when both expressions are SMALLINT.

  • An INTEGER when one or both expressions are INTEGER and neither is BIGINT.

  • A BIGINT when at least one expression is BIGINT.

Examples

SELECT numberCol1, numberCol2, MOD(numberCol1, numberCol2) AS numberColMod FROM MYSQL.inventory.cust;

VALUES MOD(5,2);
-- Returns 1