Mysql Mod (a,b) is performed to return remainder when b is divided by a.
Incase you use MOD(a, 3) you get 1 for even numbers and 0 for odd numbers.
If you use MOD(a, 2) you get the last digit of the number a.
Understand with Example
The Tutorial illustrate an example from Mysql Mod. To understand and grasp the example we create a table oddeven with required fieldnames and datatypes respectively.
Query for creating table named oddeven:
Query for inserting data into table named oddeven:
The Query insert into is used to add the records or rows to the table 'oddeven'
Query for viewing data of table named oddeven:
Query for finding mod of the two fields from table named oddeven:
The Query used below is used to return the mode value as remainder when b is divided by a.