Snowflake Vs MS-SQL - Part 85 - UNION ALL BY NAME

       



UNION ALL BY NAME

Sometimes, we have to combine data from multiple tables. In this case, we can use UNION or UNION ALL. However, the catch is that the column order or the number of columns in both tables must be the same.


MS-SQL Server 

We can achieve this using UNION as shown below, specifying the column names. We cannot use (*) in the select clause as the number of columns and their names are different:


In Snowflakewe can use the same query as above; however, we can use the (*) in the select clause with UNION ALL BY NAME as below. The order of the columns in the select clause does not matter.





For more details, you can refer to the following: UNION_ALL_BY_NAME
.



 

Comments

Popular posts from this blog

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

Snowflake Vs MS-SQL - Part 70 - UNION By Name

Snowflake Vs MS-SQL - Part 68 - Multi Table Insert