Solving SQL Query | Rows to Column in SQL



Solving SQL Query | Rows to Column in SQL

Solving SQL Query | Rows to Column in SQL

In this video, we will solve an SQL Query where we will need to transform data from rows to column.
We can transform data from rows to column in SQL using PIVOT operator but not all RDBMS supports PIVOT. Microsoft SQL Server and Oracle supports PIVOT operator, whereas in PostgreSQL, we can transform rows to column using CROSSTAB function. Similarly in MySQL database, rows to column transformation can be done using the CASE statement.

Hence in this video, we shall first look at the SQL query problem statement. We understand the input data and also understand the expected output. After this we shall write SQL query to solve this problem using PIVOT in Microsoft SQL Server and in Oracle.
We shall then solve the same problem in PostgreSQL database using CROSSTAB function. Finally we shall also solve this query in MySQL database using the CASE statement.

All the datasets, scripts and SQL queries used in this video can be downloaded from my blog and from my discord channel. Links below:
Blog: https://techtfq.com/video/solving-sql-query-rows-to-column-in-sql
Discord: https://discord.gg/8aRSbygbdu

If you would like to share any interesting SQL query with me so that I can make a video about it then do share them in the email below:
Email id: [email protected]

Timestamp:
00:00 Intro
01:58 Understanding the SQL Query Problem statement
04:20 Solving SQL Query in Microsoft SQL Server using PIVOT
26:59 Solving SQL Query in Oracle using PIVOT
32:46 Solving SQL Query in PostgreSQL using CROSSTAB
55:31 Solving SQL Query in MySQL using CASE statement

🔴 WATCH MORE VIDEOS HERE 👇

✅ SQL Tutorial – Basic concepts:
https://www.youtube.com/playlist?list=PLavw5C92dz9HQQ_COgGb7kf_1H8UWUBxO

✅ SQL Tutorial – Intermediate concepts:
https://www.youtube.com/playlist?list=PLavw5C92dz9FD9XspliRM_HZM_jK7tkii

✅ SQL Tutorial – Advance concepts:
https://www.youtube.com/playlist?list=PLavw5C92dz9GbmgiW4TWVnxhjMFOIf0Q7

✅ Practice Solving Basic SQL Queries:
https://www.youtube.com/playlist?list=PLavw5C92dz9F66P3GFo5O6nJ4DfZNhVsp

✅ Practice Solving Intermediate SQL Queries:
https://www.youtube.com/playlist?list=PLavw5C92dz9EIYmNXJ8ZtQ1bmLIpt0SpV

✅ Practice Solving Complex SQL Queries:
https://www.youtube.com/playlist?list=PLavw5C92dz9Fahr7taauUx5RnTfuGyL–

✅ Data Analytics Career guidance:
https://www.youtube.com/playlist?list=PLavw5C92dz9FDsr995DjwCy9XNaIukb8P

✅ SQL Course, SQL Training Platform Recommendations:
https://www.youtube.com/playlist?list=PLavw5C92dz9GqF1Q_zn8KnYvFgtEOh-2n

✅ Python Tutorial:
https://www.youtube.com/playlist?list=PLavw5C92dz9FePZXIo4jpsupqp3X0w2SW

THANK YOU,
Thoufiq

Comments are closed.