Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

MOD

Example

Provide the remainder resulting from dividing 18 by 4.

SELECT MOD(18, 4); 

Definition and Usage

The MOD() function computes the remainder when dividing one number by another.

Syntax

MOD(xy)

OR:

x MOD y

OR:

y

Parameter Values

Parameter

Description

x

Mandatory: A value that will undergo division by y.

y

Mandatory: The number by which the value will be divided.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Find the remainder when 18 is divided by 4.

SELECT 18 MOD 4

Example

Calculate the remainder from the division of 18 by 4.

SELECT 18 % 4;