set based example

Specific row at the top then sort the rest result set in SQL Server

In this post, “Specific row at the top then sort the rest result set in SQL Server“, we are going to learn that how we can order a result set in a customized way which cannot be achieved using ORDER by Clause in a simple way. To demonstrate this, let’s create a sample table named as “tbl_Department” and insert […]

Specific row at the top then sort the rest result set in SQL Server Read More »

Extract the first number from an alphanumeric string in sql server

In this post, we are going to learn how to extract the first numeric value from an alphanumeric string in SQL Server. To demonstrate this, we will create a dummy table and then we will insert some dummy rows into that table. Finally, we will use a SELECT statement to extract the first numeric value

Extract the first number from an alphanumeric string in sql server Read More »

Unfolding | Set Based Approach | Get Continuous Start Date of the Current Project – Episode 8

In this video, we are going to learn; How and when to use Apply operator in SQL Server, and How to compare rows on a given logic You can download the script used in this example from below the video.

Unfolding | Set Based Approach | Get Continuous Start Date of the Current Project – Episode 8 Read More »

Unfolding | Set Based Approach | Create Attendance Report – Episode 7

In this video, we are going to learn; Generate date list from the given date range dynamically Repeat the date list for each employee without using a loop or recursive CTE You can download the script used in this example from below the video.  

Unfolding | Set Based Approach | Create Attendance Report – Episode 7 Read More »

Unfolding | Set Based Approach | Generate Rows Dynamically – Episode 6

In this video, we are going to learn; How we can Generate rows dynamically for each record of a table in set based approach, and How to do calculations on each row of a table generated dynamically You can download the script used in this example from below the video.

Unfolding | Set Based Approach | Generate Rows Dynamically – Episode 6 Read More »

Unfolding | Set Based Approach | How join works internally – Episode 4

In this video, we are going to understand how join works internally. If you have a good understanding of joins and how it works, you can skip this video and move to the next video in this series. If not, lets start understanding the joins. You can download the script used in this example from below the video. Here

Unfolding | Set Based Approach | How join works internally – Episode 4 Read More »

Unfolding | Set Based Approach | SQL Server Query execution architecture – Episode 3

In this video, we are going to understand the query execution architecture which helps us to understand the importance of set based approach. When a T-SQL statement gets submitted to SQL server, it goes through multiple steps before we get the final output. Lets have a look on SQL Server query execution architecture.

Unfolding | Set Based Approach | SQL Server Query execution architecture – Episode 3 Read More »

Unfolding | Set Based Approach | Introduction to the course – Episode 2

This video will give you insight of the topic that we are going to cover in this series. We know that the thinking in terms of sets is creative and innovative and once you start understanding the concepts, believe me, you will find it is simple too. Writing set based queries needs a good understanding

Unfolding | Set Based Approach | Introduction to the course – Episode 2 Read More »

Unfolding | Set Based Approach | Why set based approach – Episode 1

Welcome to my course “Unfolding | Set Based Approach”. This is my first video tutorial series. In this series, I am going to share the concepts and techniques being used to create set based SQL queries. This course is not based on how to write queries (this you can find at many places), rather it is based on

Unfolding | Set Based Approach | Why set based approach – Episode 1 Read More »