Training
Module
Add decision logic to your code using `if`, `else`, and `else if` statements in C# - Training
Learn to branch your code's execution path by evaluating Boolean expressions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
if
functionApplies to: Databricks SQL
Databricks Runtime
Returns expr1
if cond
is true
, or expr2
otherwise. This function is a synonym for iff
function.
if(cond, expr1, expr2)
cond
: A BOOLEAN expression.expr1
: An expression of any type.expr2
: An expression that shares a least common type with expr1
.The result is the common maximum type of expr1
and expr2
.
> SELECT if(1 < 2, 'a', 'b');
a
Training
Module
Add decision logic to your code using `if`, `else`, and `else if` statements in C# - Training
Learn to branch your code's execution path by evaluating Boolean expressions.