Logical Functions
name | description |
---|---|
COALESCE | Return the first non-null value in arguments |
IF | Return a value by condition |
IFNULL | Return a value whether passed value is null |
NULLIF | Return null whether passed values are equal |
Definitions
COALESCE
COALESCE(value [, value ...])
- value
- value
- return
- primitive type
Returns the first non-null value in arguments. If there is no non-null value, then returns null.
IF
IF(condition, value1, value2)
- condition
- value
- value1
- value
- value2
- value
- return
- primitive type
If condition is TRUE, then returns value1. Otherwise, returns value2.
IFNULL
IFNULL(value1, value2)
- value1
- value
- value2
- value
- return
- primitive type
If value1 is null, then returns value2. Otherwise returns value1.
NULLIF
NULLIF(value1, value2)
- value1
- value
- value2
- value
- return
- primitive type
If value1 is equal to value2, returns null. Otherwise returns value1.