Home  >  Blog  >   Snowflake

How to Write a Case Statement in Snowflake

In Snowflake, we will use the “Case” statement for working with the “if” statement in the “Select” statement. This blog illustrates writing the case statement through an example.

Rating: 4.6
  1. Share:
Snowflake Articles

Write a Case Statement in Snowflake

We use “CASE” statements while reaching for the "IF" statement in our "SELECT" clause.

when percentage = 35 then ‘pass’
when percentage = 60 then ‘first class’
when percentage = 75 then ‘distinction’
when percentage >= 95 then ‘excellent’
else ’fail’
end as good_marks
From students

MindMajix Youtube Channel


We will write a “Case” statement in the “Select” statement to work with the “if” statement. I hope this helps you use the “Case” statement in the “if” statement.

Snowflake Related Articles

▶  Snowflake vs Redshift
▶  Snowflake vs BigQuery
▶  Snowflake vs Databricks
▶  Snowflake vs Azure
▶  Snowflake vs Hadoop
▶  Snowflake Time Travel

If you have any queries, let us know by commenting below.

Join our newsletter

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
Snowflake TrainingApr 27 to May 12View Details
Snowflake TrainingApr 30 to May 15View Details
Snowflake TrainingMay 04 to May 19View Details
Snowflake TrainingMay 07 to May 22View Details
Last updated: 04 Apr 2023
About Author

Kalla Saikumar is a technology expert and is currently working as a Marketing Analyst at MindMajix. Write articles on multiple platforms such as Tableau, PowerBi, Business Analysis, SQL Server, MySQL, Oracle, and other courses. And you can join him on LinkedIn and Twitter.

read more