How to Get First Row of each Group in Snowflake?

In the data warehouse reporting, you will encounter many different scenarios. One of such scenario is to get first row of each group. For example, identify the department wise highest salary. In this article, we will check how to select or get first row of each group in Snowflake. Select First Record of each Group in Snowflake Selecting first row of each group in SQL is one of the common query in reporting. You need to use proper function that does not take much time to return results. Following are…

Continue ReadingHow to Get First Row of each Group in Snowflake?
Comments Off on How to Get First Row of each Group in Snowflake?

What are INSTR Alternative Functions in Redshift?

The INSTR function in relational databases such as Oracle, Teradata, etc. is used to search a string for a substring and find the location of the substring in the string. The Amazon Redshift does not support the INSTR function. However, there are few string functions that you can use. In this article, we will check what are INSTR alternative functions in Redshift. SQL INSTR String Function The SQL INSTR function returns the location of a substring in a string. Optionally, you can provide the starting position and occurrence of the…

Continue ReadingWhat are INSTR Alternative Functions in Redshift?
Comments Off on What are INSTR Alternative Functions in Redshift?

SQL GROUPING SETS Alternative in Synapse

The GROUPING SETS option in SQL gives you the ability to combine multiple GROUP BY clauses into one GROUP BY clause. By definition, a grouping set is a group of columns by which you group. Azure Synapse SQL data warehouse does not support GROUPING SETS. In this article, we will check this SQL GROUPING SETS alternative in Azure Synapse SQL data warehouse with an example. SQL GROUPING SETS Alternative in Synapse As mentioned, GROUPING SETS will combine multiple GROUP BY clauses into one GROUP BY clause. The results are the…

Continue ReadingSQL GROUPING SETS Alternative in Synapse
Comments Off on SQL GROUPING SETS Alternative in Synapse