How to Write a Snowflake Case When
Case statements are useful when you're reaching for an if statement in your select
clause.
select
id,
name,
category,
unit_price,
case
when category = 5 then 'Premium'
when category = 4 then 'Gold'
when category = 3 then 'Standard'
when category <= 2 then 'Basic'
else 'unknown'
end as quality_level
from products;
From Snowflake query to chart to Slack in seconds
Get to answers faster, together, with PopSQL and Snowflake
From Snowflake query to chart to Slack in seconds
Get to answers faster, together, with PopSQL and Snowflake