Presto check if NULL and return default (NVL analog) Presto check if NULL and return default (NVL analog) sql sql

Presto check if NULL and return default (NVL analog)


The ISO SQL function for that is COALESCE

coalesce(my_field,0)

https://prestodb.io/docs/current/functions/conditional.html

P.S. COALESCE can be used with multiple arguments. It will return the first (from the left) non-NULL argument, or NULL if not found.

e.g.

coalesce (my_field_1,my_field_2,my_field_3,my_field_4,my_field_5)