Mega Code Archive

 
Categories / PostgreSQL / Math Functions
 

Mod(x, y)

postgres=# postgres=# -- mod(x, y): Returns the remainder (modulus) when dividing x / y postgres=# SELECT mod(5, 5) AS no_remainder, postgres-#        mod(6, 5) AS remainder_one, postgres-#        mod(19, 5) AS remainder_four;  no_remainder | remainder_one | remainder_four --------------+---------------+----------------             0 |             1 |              4 (1 row) postgres=#