In Postgres database, COALESCE returns the first non-null value in the list of expressions passed to the function. It returns a null value if all the expressions passed to the function are null.
Syntax:
SELECT COALESCE(value1, value2, value3, ..) from table1;
Returns value1 if value1 is not null
Returns value2 if value1 is null
Returns value3 if both value1 and value2 are null.
COALESCE function is used to return a non-null value if the value you’re looking for is null.