Example
Return the remainder of 18/4:
sql
SELECT MOD(18, 4);
Definition and Usage
The MOD() function returns the remainder of a number divided by another number.
Syntax
text
MOD(x, y)
text
x MOD y
text
x % y
OR:
OR:
Parameter Values
| Parameter | Description |
|---|---|
| x | Required. A value that will be divided by y |
| y | Required. The divisor |
Technical Details
| Works in: | From MySQL 4.0 |
|---|
More Examples
Example
Return the remainder of 18/4:
sql
SELECT 18 MOD 4;
Example
Return the remainder of 18/4:
sql
SELECT 18 % 4;