IF
Purpose
The IF THEN ELSE syntax is an alternate to CASE function.
Syntax
if::=
Usage Notes
- If the condition evaluates to true, the expression after THEN is returned.
- If the condition evaluates to false, the expression after ELSE is returned, or NULL if an ELSE expression is not defined.
- If the condition evaluates to NULL/UNKNOWN, the expression returns NULL.
Examples
Result
NAME | AGE | LEGALITY |
Alice | 25 | adult |
Bob | 16 | underaged |
Charlie | NULL | NULL |
David | 34 | adult |