bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL MOD() Function

Concept visual

MySQL MOD() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the remainder of 18/4:

SELECT MOD(18, 4);

Definition and Usage

The MOD() function returns the remainder of a number divided by another number.

Syntax

Mod(

x, y )

OR:

x

Mod

y

OR:

x % y

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:

SELECT 18 MOD 4;

Example

Return the remainder of 18/4:

SELECT 18 % 4;

Previous

❮ MySQL Functions

Next

Previous

MySQL MIN() Function

Next

MySQL PI() Function