CASE (Lakehouse v2)
Evaluates conditions and returns a value when the first condition is met.
Analyze Syntax
Section titled “Analyze Syntax”case((get_column(table, 'status') == 1, 'Active'), else_='Inactive')Analyze Examples
Section titled “Analyze Examples”case((get_column(table, 'salary') > 100000, 'High'), (get_column(table, 'salary') > 60000, 'Medium'), else_='Low')SQL Syntax
Section titled “SQL Syntax”CASE((<status> == 1, 'Active'), else_='Inactive')SQL Examples
Section titled “SQL Examples”SELECT name, CASE WHEN salary > 100000 THEN 'High' WHEN salary > 60000 THEN 'Medium' ELSE 'Low' END AS bandFROM employees;
┌─────────┬────────┐│ name │ band │├─────────┼────────┤│ Alice │ High ││ Bob │ Medium ││ Charlie │ Low │└─────────┴────────┘