Mysql Mod Function

Mysql Mod Function is used to return the remainder of N divided by M.

Mysql Mod Function

Mysql Mod Function

     

Mysql Mod Function is used to return the remainder of N divided by M. The Syntax used for Mysql Mod Function is given below:

SYNTAX:-Select MOD(N,M);

Returns the remainder of N divided by M.

Query for Modulo operation:

The Query given below MOD is used to return the remainder of 34 divided by 3 as fieldname 'MODULUS'.

 

 

 

mysql> SELECT MOD(34,3)as MODULUS;

Output:-

+---------+
| MODULUS |
+---------+
|       1 |
+---------+
1 row in set (0.00 sec)

Query:-

mysql> select 11 mod 3 as MODULUS;

Output:-

+---------+
| MODULUS |
+---------+
|       2 |
+---------+
1 row in set (0.00 sec)