Conditional Expressions

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Conditional expressions select one of multiple result values. Use conditional expressions to:

  • Branch on conditions to return different results for different cases.
  • Substitute defaults for NULL values or convert specific values to NULL.
  • Select the largest or smallest value from a list of expressions.

Considerations 

  • CASE and COALESCE evaluate only the subexpressions needed to determine the result. GREATEST and LEAST evaluate every argument.
  • The data types of all result values must be convertible to a single output type.

Conditional Logic 

Return different results based on conditions:

  • CASE — Return a result based on the first matching condition or value.

Null Handling 

Substitute defaults for NULL values or convert values to NULL:

  • COALESCE — Return the first non-NULL argument.
  • NULLIF — Return NULL when two values are equal.

Value Selection 

Choose the largest or smallest value from a list:

Related Documentation