Site icon Database Tutorials

Nullif In PostgreSQL

In today’s article, we will be explaining what is nullif in PostgreSQL and how to use it.

The nullif function returns NULL if the two values specified in parentheses are the same.

If two values are different from each other, it returns the first given value.

NULLIF(value1,value2)

As seen above, Null value is returned when two same values are entered.

Let’s see what it does when different values are entered.

As seen above, when two separate values are entered, the first value specified in parentheses is taken.

Exit mobile version