In this PostgreSQL post explains how to use the PostgreSQL mod function with syntax and examples.
The PostgreSQL mod function returns the remainder of n divided by m.
The syntax for the mod function in PostgreSQL is:
mod( n, m )
A numeric value whose remainder you wish to find.
The number used to divide into n.
The mod function can be used in the following versions of PostgreSQL:
Let's look at some PostgreSQL mod function examples and explore how to use the mod function in PostgreSQL.
For example:
postgres=# SELECT mod(12, 5);
mod
-----
2
(1 row)
postgres=# SELECT mod(12, 0.18);
mod
------
0.12
(1 row)
postgres=# SELECT mod(100, 3.5938);
mod
--------
2.9674
(1 row)