Concatenating many rows into a single row using SQL

  Hi, There have been many instances where we do need to concatenate multiple rows into a single row that too through SQL. Let us try to achieve this right here. Suppose we have a table by the name of Students. And its contents are shown below: And the result that we want is something like this: This can be achieved by the below query: If required we can further optimize the query:

Understanding SQL Joins

Hi, Today we will be trying to understand the already much spoken about topic in SQL (T-SQL), "Joins". SQL joins can either make or break any Sql query. In T-SQL we basically have the following types of joins: Inner Join / Natural Join Left Join / Left Outer Join Right Join / Right Outer Join Full Outer Join Cross Join / Cartesian Product Lets us take an example of two different tables and then try to show the output using different joins. Let there be two different tables, Table T1 and Table T2. The structure of the two tables along

Finding Non- SARGable queries

SARGable means Search ARGument Able and relates to the ability to search through an index for a value. Now this might impact your queries in a huge way. This will tell you whether your query is performing a table scan or a column/index scan. Given below is an crude attempt to get all the queries and then differentiate between them on the basis of scan they perform Its not a very sophisticated query (it only took a few minutes to write and yes, I agree, I should shred the xml instead of using a convert and like) but it shows

Columnstore Indexes

Hi, We all know about the two different types of indexes i.e. clustered and non-clustered indexes. However starting from SQL Server 2012 a new index was made available i.e. Columnstore index. Traditional indexes group and store row data but the columnstore index on the other hand stores data by columns instead of by rows. It then joins all the columns to complete the index. This way when a query is fired the columnstore index retrieves only the required columns thus reducing the amount of data retrieved from storage hence increasing the turn around time and thereby maximizing performance. Columnstore index

Columnstore Indexes

Hi, We all know about the two different types of indexes i.e. clustered and non-clustered indexes. However starting from SQL Server 2012 a new index was made available i.e. Columnstore index. Traditional indexes group and store row data but the columnstore index on the other hand stores data by columns instead of by rows. It then joins all the columns to complete the index. This way when a query is fired the columnstore index retrieves only the required columns thus reducing the amount of data retrieved from storage hence increasing the turn around time and thereby maximizing performance. Columnstore index

Finding Non- SARGable queries

SARGable means Search ARGument Able and relates to the ability to search through an index for a value. Now this might impact your queries in a huge way. This will tell you whether your query is performing a table scan or a column/index scan. Given below is an crude attempt to get all the queries and then differentiate between them on the basis of scan they perform Its not a very sophisticated query (it only took a few minutes to write and yes, I agree, I should shred the xml instead of using a convert and like) but it shows

Understanding SQL Joins

Hi, Today we will be trying to understand the already much spoken about topic in SQL (T-SQL), "Joins". SQL joins can either make or break any Sql query. In T-SQL we basically have the following types of joins: Inner Join / Natural Join Left Join / Left Outer Join Right Join / Right Outer Join Full Outer Join Cross Join / Cartesian Product Lets us take an example of two different tables and then try to show the output using different joins. Let there be two different tables, Table T1 and Table T2. The structure of the two tables along

Concatenating many rows into a single row using SQL

  Hi, There have been many instances where we do need to concatenate multiple rows into a single row that too through SQL. Let us try to achieve this right here. Suppose we have a table by the name of Students. And its contents are shown below: And the result that we want is something like this: This can be achieved by the below query: If required we can further optimize the query: