Posts

Snowflake Vs MS-SQL - Part 4 - Truncate and Insert

Image
     Truncate and Insert    MS-SQL Server   Suppose if you want to Insert new set of data in a table and prior to that if you want to remove all records then you can achieve this in two steps. 1. First Truncate/Delete all records from the table. 2. Insert new records into the table. However in  Snowflake  we can achieve this in single step. Insert statement is having an optional parameter OVERWRITE . This parameter specifies that the target table should be truncated before inserting the values into the table. For more details, you can refer the following  LINK . Yogesh Shinde LinkedInProfile <<< Back   Next >>>

Snowflake Vs MS-SQL - Part 3

Image
    Temporary Tables    MS-SQL Server   When you create temporary table, you can NOT create with same name as that of main table. In SQL, you have to use # or ## to create temporary table. However  Snowflake  does allow to create temporary table with same name as that of main table. Consider you have a table "Main_Table" under DEV schema say with 1000 records and if you create temporary table without records then temporary table gets created. When you fire a select query as below, it returns zero records. This means it pulls the records from newly created temporary table and not from the main table. If you create a view on this newly created temp table and fire select statement on the view then you  get zero records. If you move to different session/worksheet and fire select statement on view then you get actual count of the table. Because temporary table's scope is for a particular session. And finally, when you drop this table, temporary table g...

Snowflake Vs MS-SQL - Part 2

Image
   Trailing Comma in Select Statement   MS-SQL Server  does NOT support trailing Comma in SELECT Statement. If you try to run the query with trailing comma at the end, then you may get an error like " Incorrect syntax near the keyword 'from'. " However Snowflake  does support trailing Comma in SELECT Statement. If you try to run the above query with trailing comma at the end, it will NOT throw an error and will pull result. You can read more about this at  Trailing_Comma_Select  Yogesh Shinde LinkedInProfile <<< Back   Next >>>

Snowflake Vs MS-SQL - Part 1

Image
  Different Versions of Stored Procedure I've spent a lot of time developing MS-SQL Server code. After I started working on Snowflake, I experienced a different approach to the same thing. Here I am trying to list various aspects of Snowflake compared to MS-SQL Server. In MS-SQL Server, with same name you can create SP which will return two different results based on the call.  It is not overloading. A. First Version B. Second Version   When you will execute this SP, you will get the output similar like this:  Code inside Stored Procedure will look like this:   If you search under Object Explorer, you will find only one instance. In Snowflake, you can create two instances of Stoerd Procedure with same name A. First Version B. Second Version      When you will execute these SPs, you will get the output similar like this:     If you search under Object Explorer, you will find two instances.   Pl...

Snowflake Key Concepts

Image
  Snowflake is a cloud-based data warehouse that offers scalable and secure storage and processing of structured and semi-structured data. Snowflake uses a shared-nothing architecture for parallel processing and offers native support for SQL as well as other programming languages such as Python, R, and Java   Snowflake’s unique architecture consists of three key layers: -           Database Storage -           Query Processing -           Cloud Services In Snowflake, they have done the decoupling of storage and compute.   Virtual Warehouse: -           A compute resource in Snowflake that processes queries and performs data loading and unloading. -           It can be independently scaled up or down based on demand. -   ...