What is PIVOT and UNPIVOT?

          

Interview questions

SQL Server - What is PIVOT and UNPIVOT?

Next>>         SQL Server tutorial  

SQL Server - What is PIVOT and UNPIVOT? - Feb 27, 2010 at 11:50 AM by Shuchi Gauri

What is PIVOT and UNPIVOT?

Pivot and Unpivot are relational operators which can be used to change a table valued expression into another table. PIVOT rotates a table-valued expression by turning the unique values from one column into multiple columns in output, and performs aggregations where they are required on any remaining column values that are needed in the output.

UNPIVOT performs the opposite operation to PIVOT by rotating columns of a table-valued expression into column values.

SQL Server - What is PIVOT and UNPIVOT? - May 05, 2009 at 22:00 PM by Rajmeet Ghai

What is PIVOT and UNPIVOT?

PIVOT is a relational operator used to provide a more readable or simpler view of a table’s data. This is achieved by rotating a rows data into columns using the query response to simply the query results.

UNPIVOT is the opposite. It rotates columns into rows.

PIVOTING can make the sales data below

Employee Jan Feb Mar
John 1000 2000 3000
Mike - 1500 -
Tom 800 - 650

EmployeeName Month Sales
John Jan 1000
John Feb 2000
John March 3000
Mike Feb 1500
Tom Jan 800
Tom Mar 600

SQL Server - What is PIVOT and UNPIVOT? - May 18, 2009 at 10:00 AM by Rajmeet Ghai

What is PIVOT and UNPIVOT?

PIVOT operator collects data from tables in rows and converts them to columns. This results in more columns and few rows.

UNPIVOT operator does the opposite. It converts column based data to rows.

SQL Server - What is PIVOT and UNPIVOT? - June 21, 2009 at 09:00 AM by Amit Satpute

The PIVOT and UNPIVOT are relational operators used to change a table-valued expression into another table.

PIVOT rotates a table-valued expression by turning the unique values from one column in the expression into multiple columns in the output. And then it performs aggregations where ever required on the rest of the column values needed in the final output.

UNPIVOT performs the opposite operation to PIVOT by rotating columns of a table-valued expression into column values.

SQL Server PIVOT and unPivot - July 22, 2008 at 8:10 am

What is PIVOT and unPivot features in SQL?

Answer
PIVOT feature is for analytical view that presents the row data to column. It summarizes data in cross tab format.

Unpivot feature is used to unpivot the pivoted data.


Next>>

Also read

What is SQL Server English Query?

Answer - SQL Server English Query helps to build applications that can accept query.....

What is the purpose of SQL Profiler in SQL server?

Answer - SQL Profiler captures SQL Server events from a server. The events are saved.....

What are the ways available in SQL Server to execute SQL statements?

Answer - SQL Server uses different ways to execute SQL statements which are listed below......

Explain the SQL TOP statement. Write SQL syntax for the SQL TOP statement along with an example.

TOP clause is used to specify the number of records to return. Usually used for large tables.................  

Explain the SQL UNION ALL statement. Write SQL syntax for the SQL UNION ALL statement along with an example.

SQL UNION ALL: The UNION ALL operator is used to combine the result-set of two or more SELECT statements Tables of both the select statement ................



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring