PostgreSQL – MOD Function

In PostgreSQL, the MOD() function is used to calculate the remainder of a division operation between two numeric values. It returns the remainder after dividing the first argument by the second argument.

The basic syntax of the MOD() function is as shown below:

MOD(dividend, divisor)

In the above syntax, dividend is the numeric value that you want to divide

and divisor is the numeric value that you want to use as the divisor.

Here is an example of using the MOD() function:

SELECT MOD(10, 3) AS remainder;

This query will return 1, as the remainder of dividing 10 by 3 is 1.

Similar Posts