How to convert columns to rows in SQL using UNPIVOT | SQL Query Profiler

preview_player
Показать описание
In this video, we'll try to find out whether UNPIVOT is the best way to transpose column data into rows in SQL Server.

There are several methods to switch data from columns to rows, or vice versa. Let's examine each method separately and take a look at their execution plans to review query performance.

For this, we will use the functionality of dbForge Studio for SQL Server which is an all-in-one IDE for SQL Server development, management, and administration.

⭐️ Timesteps:
00:00 Introduction
00:38 Convert data from columns into Rows using UNION ALL statements
01:17 The execution plan of the query in Query Profiler functionality
01:37 Transpose columns to rows using the UNPIVOT operator
01:52 Display Estimated Execution Plan
01:57 Rotate columns to rows with the VALUES statement
02:00 Check the execution plan of the query
02:05 Using dynamic SQL
02:26 Execute dynamic UNPIVOT query with XML
02:45 Compare the execution plans of the five methods
03:05 Practical scenario - find the most frequent outcome of the game for each player
03:12 Detect bottlenecks in the SQL query using Query Profiler
03:35 Use the VALUES statement to solve this tas
03:45 Tune query execution plan - Avoid sorting
03:54 Wrapping up

⭐️Thank you for watching!

🔥 Download a free trial of dbForge Studio for SQL Server and start eliminating performance bottlenecks today!

👉🏽Check out more information about SQL Query Profiler:

👉🏽Read our article about different ways to convert columns into rows:

🔔 Subscribe to the Devart Youtube channel:

#SQL #QueryProfiler #dbForge #Devart #SQLDatabase #DatabaseAdministration
Рекомендации по теме
Комментарии
Автор

This video is more about query efficiency than "how to convert"

LiveOnTheChat
Автор

Hi, how to unpivot data in Athena SQL

AnshulMarele-gbaa
join shbcf.ru