Snowflake Vs MS-SQL - Part 24 - Column Alias

   


Column Alias

Sometimes you have to extract the data from the database and share it in Excel and hand it to a user or someone outside. In this case, you have to ensure that you do not expose confidential details like table name or column name.

MS-SQL Server 

You can use the alias for the column name. But suppose the table has more columns like 20+ then in this case to make an alias for one column you have to list out the names of all columns and you may fill this is tedious.


Here we wanted to make an alias for Column_2, we have to list out ALL columns.

In Snowflake, we don't need to mention ALL column names as above. We can use the keyword Rename.



If you see here, I wanted to hide the SSN column and alias it as code. I can use the Rename keyword along with Select *.

In case, you want to provide an alias for multiple columns then you can use as follows:




For more details, you can refer to the following Rename_1 or Rename_2.




  

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