PostgreSQL MOD Function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PostgreSQL MOD() function

MOD() function

The PostgreSQL mod() function is used to return the remainder of a division of two numbers, as specified in the argument.

Syntax :

mod()

PostgreSQL Version : 9.3

Pictorial presentation of PostgreSQL MOD() function

Example : PostgreSQL MOD() function

SELECT MOD(38,5) AS "Remainder";

Output :

 Remainder
-----------
         3
(1 row)

Example : PostgreSQL MOD() function using negative value

SELECT MOD(-38,5) AS "Remainder";

Output :

 Remainder
-----------
        -3
(1 row)