Name

MOD

The MOD function returns the remainder of a dividend divided by a divider. All platforms support the ANSI SQL syntax for the MOD function.

ANSI SQL Standard Syntax

MOD( dividend, divider )

The standard syntax for the MOD function is to return the remainder of the dividend divided by the divider; it returns the dividend if the divider is 0.

Example

The following example shows how to use the MOD function from within a SELECT statement:

SELECT MOD(12, 5) FROM NUMBERS
2

Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.