Conditional Expressions
Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API
markdownreferencev1B91B-WS7Pguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sqlConditional ExpressionsData 360Data CloudData 360 Query Guide
Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/conditional-func.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.
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
NULLvalues or convert specific values toNULL. - Select the largest or smallest value from a list of expressions.
CASEandCOALESCEevaluate only the subexpressions needed to determine the result.GREATESTandLEASTevaluate every argument.- The data types of all result values must be convertible to a single output type.
Return different results based on conditions:
- CASE — Return a result based on the first matching condition or value.
- IFF — Select an expression based on a Boolean condition; a NULL condition selects the false expression.
Substitute defaults for NULL values or convert values to NULL:
- COALESCE — Return the first non-
NULLargument. - NVL and IFNULL — Return a replacement when the first expression is NULL;
IFNULLis an alias ofNVL. - NULLIF — Return
NULLwhen two values are equal. - NULLIFZERO — Return NULL when numeric input is zero.
- ZEROIFNULL — Return zero when numeric input is NULL.
Choose the largest or smallest value from a list:
- GREATEST and LEAST — Select the largest or smallest value from a list of expressions.