Selects result values that satisfy search conditions and value comparisons.
specifies any valid SQL expression that evaluates to a table column whose values are compared to when-expression.
| See | <sql-expression> |
| FedSQL Expressions |
specifies any valid SQL search condition expression or a value expression.
| See | <sql-expression> |
specifies an SQL expression that evaluates to a value.
| See | <sql-expression> |
case
when value1 is not null
then value1
when value2 is not null
then value2
else value3
end coalesce(value1, value2, value3)
case when value1 = -1 then null else value1 end
nullif(value1, -1);
select AvgLow,
case
when AvgLow < 32 then AvgLow + 2
when ((AvgLow < 60) and (AvgLow > 32)) then AvgLow + 5
when AvgLow > 60 then AvgLow + 10
else AvgLow
end
as Adjusted from worldtemps;
select Country,
case Country
when 'Algeria' then 'Africa'
when 'Nigeria' then 'Africa'
when 'Netherlands' then 'Europe'
when 'Spain' then 'Europe'
when 'Switzerland' then 'Europe'
when 'China' then 'Asia'
when 'India' then 'Asia'
when 'Venezuela' then 'South America'
else 'Unknown'
end
as Continent from worldtemps;