Jump to: navigation, search

Mysql MOD

From w3cyberlearnings

Contents

MySQL MOD Function

This function returns the remainder of X divided by Y.

Syntax MOD

  • X is dividend
  • Y is divisor
MOD(X,Y);

OR 

X % Y

OR

X MOD Y

Example 1

mysql> SELECT MOD(204,10);
+-------------+
| MOD(204,10) |
+-------------+
|           4 |
+-------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT 19 % 4;
+--------+
| 19 % 4 |
+--------+
|      3 |
+--------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References