PostgreSQL DIV Function

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

PostgreSQL DIV() function

DIV() function

The PostgreSQL div() function is used to return the integer quotient of a division as specified in the argument.

Syntax :

div()

PostgreSQL Version : 9.3

Pictorial presentation of PostgreSQL DIV() function

Example : PostgreSQL DIV() function

SELECT DIV(19,3) AS "Quotient";

Output :

 Quotient
----------
        6
(1 row)

Example : PostgreSQL DIV() function using negative value

SELECT DIV(-27,5) AS "Quotient";

Output :

 Quotient
----------
       -5
(1 row)ssss