<expression1> if it’s non-NULL, otherwise returns <expression2>.
Syntax
Parameters
| Parameter | Description | Supported input types |
|---|---|---|
<expression1>, <expression2> | Expressions that evaluate to any data type that Firebolt supports. | Any |
Return Types
Same as input typeRemarks
UseZEROIFNULL(<expression>) as a synonym shorthand for IFNULL(<expression>, 0).
IFNULL(a, b) has the same behaviour as COALESCE(a, b).
Example
The following truth table demonstrates values thatIFNULL returns based on the values of two columns: level and player_id:
| level | player_id | IFNULL(level,player_id) | IFNULL(player_id,level) |
|---|---|---|---|
| 0 | 32 | 0 | 32 |
| 1 | null | 30 | 30 |
| null | 33 | 33 | 33 |
| null | null | null | null |