MOD(N,M), N % M, N MOD M: modulo operation. returns the remainder of N divided by M. : MOD « Math Numeric Functions « MySQL Tutorial

Home
MySQL Tutorial
 1 Introduction 2 Select Query 3 Database 4 Table 5 Table Join 6 Subquery 7 Insert Update Delete 8 Logic Operator 9 View 10 Data Types 11 Procedure Function 12 Cursor 13 Trigger 14 Date Time Functions 15 Comparison Functions Operators 16 Aggregate Functions 17 Cast Functions Operators 18 Control Flow Functions 19 Encryption Compression Functions 20 Information Functions 21 Math Numeric Functions 22 Miscellaneous Functions 23 String Functions 24 Regular Expressions 25 Data Dictionary 26 MySQL Utilities 27 Privilege
 MySQL Tutorial » Math Numeric Functions » MOD
21.24.1.MOD(N,M), N % M, N MOD M: modulo operation. returns the remainder of N divided by M.
 ```mysql> mysql> SELECT MOD(234, 10); +--------------+ | MOD(234, 10) | +--------------+ |            4 | +--------------+ 1 row in set (0.02 sec) mysql> mysql> SELECT 253 % 7; +---------+ | 253 % 7 | +---------+ |       1 | +---------+ 1 row in set (0.00 sec) mysql> mysql> SELECT MOD(29,9); +-----------+ | MOD(29,9) | +-----------+ |         2 | +-----------+ 1 row in set (0.00 sec) mysql> mysql> SELECT 29 MOD 9; +----------+ | 29 MOD 9 | +----------+ |        2 | +----------+ 1 row in set (0.00 sec) mysql>```
 21.24.MOD 21.24.1. MOD(N,M), N % M, N MOD M: modulo operation. returns the remainder of N divided by M. 21.24.2. MOD(N,0) returns NULL. 21.24.3. The modulo function returns the remainder of two numbers. 21.24.4. (MOD(4, 0)) will return a null value