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 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.
Exercise 1: Introduction to Pivoting
Exercise 2: Pivot Operator Internals
Exercise 3: Performance comparison between manual pivoting and PIVOT operator
Exercise 4: Unpivoting the data
Exercise 5: T-SQL Challenge
There are no reviews yet.