Snowflake Vs MS-SQL - Part 30 - DECODE

    


DECODE

If you want to return a value based on some condition(s).

Suppose you have values like this in a table


And you want to return like this.


MS-SQL Server 

You can achieve this by using the CASE Statement

In Snowflakewe can use a similar syntax as above; however, Snowflake provides an alternative DECODE. 


For more details, you can refer to the following DECODE





     

Comments

Popular posts from this blog

Snowflake Vs MS-SQL - Part 36 - SPLIT_TO_TABLE

Snowflake Vs MS-SQL - Part 63 - ON Clause & Cross Join

Snowflake Vs MS-SQL - Part 33 - INITCAP