- .NET Framework
- SQL Server 2005 tools
- Grouping data by using the UNPIVOT operator
Read the following topic in the Introduction to SQL Server 2005 section of Chapter 1 0f the book Querying and Managing Data using SQL Server 2005:
- The ,NET Framework
Read the following section of chapter 1 of the book Querying and Managing Data Using SQL Server 2005:
- Identifying the SQL Server 2005 Tools
The UNPIVOT operator allows database users to normalize the data that has earlier been pivoted. The UNPIVOT operator transforms the multiple column values of a record into multiple records with the same values in a single column. For example, a table that stores applications' records has one row for each applicant. The table stores the applicant's name, qualification and grade. After applying the UNPIVOT operator on the table, the table contains a different row for each qualification that the applicant has complete.
The syntax for using the UNPIVOT operator is:
SELECT
ApplicantName, newTable.Qualification, newTable.Grade
FROM tblPivot
UNPIVOT (Qualification FOR Grade IN (Matriculation, Higher Secondary, Graduation)) as tblUnPivot
No comments:
Post a Comment