MOD
MOD(a,b) | ||
---|---|---|
Engine | OK | Alternative |
ingres | Yes | |
mysql | Yes | a % b |
oracle | Yes | |
postgres | Yes | a % b |
sqlserver | No | a % b |
MOD
MOD(a,b) returns the remainder when a is divied by b
If you use MOD(a, 2) you get 0 for even numbers and 1 for odd numbers.
If you use MOD(a, 10) you get the last digit of the number a.
MOD(27,2) -> 1 MOD(27,10) -> 7