ADSENSE

Sunday 17 January 2016

Knowledge Byte

In this section you will learn about:
  • .NET Framework
  • SQL Server 2005 tools
  • Grouping data by using the UNPIVOT operator
.NET Framework

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
Working with SQL Server 2005 Tools

Read the following section of chapter 1 of the book Querying and Managing Data Using SQL Server 2005:
  • Identifying the SQL Server 2005 Tools
Grouping Data by Using the UNPIVOT Operator

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

Sunday 17 January 2016

Knowledge Byte

In this section you will learn about:
  • .NET Framework
  • SQL Server 2005 tools
  • Grouping data by using the UNPIVOT operator
.NET Framework

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
Working with SQL Server 2005 Tools

Read the following section of chapter 1 of the book Querying and Managing Data Using SQL Server 2005:
  • Identifying the SQL Server 2005 Tools
Grouping Data by Using the UNPIVOT Operator

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