SQL Advance Topics

sql-unpivot

SQL: Unpivoting Data for Analysis

Introduction In SQL , learning unpivoting of data is as important as learning pivoting of data.Sometimes we need to transform data from column to rows for efficient analysis. The UNPIVOT function is useful when you have data in a pivoted format, with values spread across multiple columns, and you want to convert it back into …

SQL: Unpivoting Data for Analysis Read More »

sql-pivot

SQL Pivot – Rows To Columns

In SQL Server, You can use PIVOT to convert rows into columns. Syntax: <non-pivoted column> are columns which are not intended for pivot[pivoted column1], [pivoted column2] are columns which we want to pivotThe Select statement in FROM clause is for source table<aggregate_function> is useful when we have two or more rows with similar primary key …

SQL Pivot – Rows To Columns Read More »

SQL LIKE Operator in Queries

SQL LIKE SQL LIKE operators are used in conjunction with WHERE clause to find patterns in the strings. Two wild card characters are used with LIKE operators-‘%’ is used to represent  zero, one, or multiple character‘_’ is used when you want to represent only one character Syntax: WHERE Clause in above statement will match with …

SQL LIKE Operator in Queries Read More »

sql_case

SQL Case Expression-SQL Conditions

SQL case are used to evaluate a set of expression and return the expression that fulfils the condition. There are two types of SQL CASE – The simple CASE expression compares an expression to a set of simple expressions to determine the result. The searched CASE expression evaluates a set of Boolean expressions to determine …

SQL Case Expression-SQL Conditions Read More »

sql-top

SQL TOP keyword – Examples

SQL TOP is used to control the amount of rows produced by the SELECT statement. When you are working with big datasets(millions of rows), it is important to keep in mind that SELECT statements use processing power of the system. SQL TOP Limits the rows returned in a query result set to a specified number …

SQL TOP keyword – Examples Read More »