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
  
 
400
  1. Share:
Snowflake Articles

Write a Case Statement in Snowflake

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

Select
id1,
name1,
percentage,
Grade,
case
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

Conclusion

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
inbox

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
NameDates
Snowflake TrainingSep 26 to Oct 11View Details
Snowflake TrainingSep 30 to Oct 15View Details
Snowflake TrainingOct 03 to Oct 18View Details
Snowflake TrainingOct 07 to Oct 22View Details
Last updated: 25 September 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
Try NOW: One-Access by MindMajix