Name
MOD( )
Synopsis
MOD(number
,number
)number
MODnumber
This function returns the remainder of a number given in the first
argument divided evenly by the number given in the second argument,
the modulo. It works the same as using the %
operator between two given numbers. The second syntax shown is
available as of Version 4.1 of MySQL. Starting with Version 4.1.7,
fractional values may be given.
SELECT MOD(10, 3); +------------+ | MOD(10, 3) | +------------+ | 1 | +------------+
Here’s an example of the alternate syntax:
SELECT 10 MOD 3; +----------+ | 10 MOD 3 | +----------+ | 1 | +----------+
Get MySQL in a Nutshell 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.