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.
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
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
If you have any queries, let us know by commenting below.
Name | Dates | |
---|---|---|
Snowflake Training | Jul 27 to Aug 11 | View Details |
Snowflake Training | Jul 30 to Aug 14 | View Details |
Snowflake Training | Aug 03 to Aug 18 | View Details |
Snowflake Training | Aug 06 to Aug 21 | View Details |
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.