To understand and analyze the data in more efficient way, we may have to rotate rows into columns and columns into rows. The rotation of rows to columns is called pivoting and the reverse operation is called unpivoting. This lab explains pivoting in SQL Server and unpivoting operation using manual coding using CASE statement(s) and by using PIVOT and UNPIVOT operators. This lab is divided into four exercises. In the first exercise, we will learn the concept of pivoting. In the second exercise, we will learn the pivoting and grouping in the presence of IDENTITY column and also will learn dynamic pivoting. In the third exercise, we will learn the performance differences between pivoting using CASE statement(s) and PIVOT operator. In the fourth and final exercise, we will learn to unpivot the pivoted data.

Subscribe to Download

File Size1.04 MB
Create DateDecember 22, 2016
Last UpdatedFebruary 4, 2017