'replacing null value
If i am using
select coalesce(firstname, surname, petname) as column_name
select isnull(firstname, surname) as column_name
Where all return the first non-null column, if all the columns are null, how can I assign what to replace the null value in output with?
Typically as below for just checking for one column, I know I can insert value if null as below
select coalesce(column_name, "value if null") as column_name
Also, can COALESCE and ISNULL be used interchangeably?
Thanks!
Solution 1:[1]
Presto does not have isnull
function.
Presto does have coalesce
syntax which takes arbitrary number of arguments; it's not a function, because it guarantees arguments are lazy-evaluated
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |