MOD in MySQL : MOD « Math « SQL / MySQL






MOD in MySQL

  
/*
mysql> select MOD(2, 3);
+-----------+
| MOD(2, 3) |
+-----------+
|         2 |
+-----------+
1 row in set (0.00 sec)

mysql> select 3 % 2;
+-------+
| 3 % 2 |
+-------+
|     1 |
+-------+
1 row in set (0.00 sec)


*/  
select MOD(2, 3);
select 3 % 2;
           
         
    
  








Related examples in the same category

1.Use the MOD() function to divide the Amount values by 10 and then return the remainder from that division.
2.The MOD() function returns the remainder derived by dividing two numbers.
3.modulus operator
4.Treat Monday as the first day of the week and Sunday as the last, use a the MOD( ) function to map Monday to 0