Amazon Timestream for LiveAnalytics will no longer be open to new customers starting June 20, 2025. If you would like to use Amazon Timestream for LiveAnalytics, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see Amazon Timestream for LiveAnalytics availability change.
The IF statement
The IF statement evaluates a condition to be true or false and returns the appropriate value. Timestream supports the following two syntax representations for IF:
if(condition, true_value)
This syntax evaluates and returns true_value
if condition is true
;
otherwise null
is returned and true_value
is not evaluated.
if(condition, true_value, false_value)
This syntax evaluates and returns true_value
if condition is true
,
otherwise evaluates and returns false_value
.
Examples
SELECT if(true, 'example 1'), if(false, 'example 2'), if(true, 'example 3 true', 'example 3 false'), if(false, 'example 4 true', 'example 4 false')
_col0 | _col1 | _col2 | _col3 |
---|---|---|---|
|
|
|
|