SQL Query - Convert data from Rows to Columns |Case | Pivot data
ฝัง
- เผยแพร่เมื่อ 5 ก.ย. 2024
- This video is part of the series on scenario based SQL Query Interview questions.
This discusses how you can use a SQL Query to convert data from rows to columns / pivot data.
This is Part 1 of the video and discusses the first approach using the CASE statement.
Below is the link for Part 2 of the video which discusses the SQL PIVOT function to achieve the same objective.
• SQL Query - Convert da...
How to install SQL Server for practice?
• How to install SQL Ser...
Check out the complete list of SQL Query Interview Questions -
• SQL Query Interview Qu...
Best Data Science / Analytics / SQL courses
Learn SQL Basics for Data Science Specialization
imp.i384100.ne...
Beginners to Python Programming
skillshare.eqc...
Data Science and Business Analytics with Python
skillshare.eqc...
Get 40% OFF of Skillshare with code FLASH40 - October 2022
skillshare.eqc...
Data Science Fundamentals with Python and SQL Specialization
imp.i384100.ne...
Python for Everybody Specialization
imp.i384100.ne...
Google Data Analytics Professional Certificate
imp.i384100.ne...
Coursera Plus - Data Science Career Skills
imp.i384100.ne...
Please do not forget to like, subscribe and share.
For enrolling and enquiries, please contact us at
Website - knowstar.org/
Facebook - / knowstartrainings
Linkedin - www.linkedin.c...
Email - learn@knowstar.org
Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022.
The Coursera Plus membership gets you access to unlimited courses and unlimited certifications!
imp.i384100.net/Ke51on
Thank you for sending the SQL Queries that you were asked in interviews.
We will be covering most of them in future videos.
If you wish to share more such queries, then you can send them to our email or put them down in the comments below!
Thank you providing multiple methods of pivoting columns into rows. Very informative and useful.
Thank you
this is outstandingly perfect
Thank you so much.
Thank you very much for this :) It saved me from a job request today big time!! Thank you!
Thanks a lot!
Thanks A lot Sister, Please keep it up. repsect from Afghanistan.
Thanks so much!
This is exactly what I was searching for. You made my day thank you so much
Glad it helped!
Hi Your Case Section on tables is great. The issue I have is when I want to show filtered records only, for example I have several forms and I wnat to only show form 5 entries. I tried WHERE formid=5 but i get error message. Hope my question makes sense.
Your voice is very sweet , Thanks for the explanation. Above approach is working on SQL server but not on Mysql please help.
very nicely explained.
Thank you
Very Informative. It helped me to solve my project requirement🤩
Glad it helped
This is great! keep up the good work.
Thank you
Thanks a lot for this efforts❤❤
Thank you
Thanks
Glad it was helpful.
very helpful video.
Thank you so much.
Thanks mam very helpful
Thank You!
what is data type of [value] column . there is mixed number and letters
Please explain real time scenarios while loading the data to a table. Ex. Will the job fail if an application layer is inserting the data and the same table is being read by other job.
Thanks for your suggestions. Will plan videos soon
We can use pivot also?
hi ; thanks for your video , but can you add another one about many rows ? ,i need help about n rows?
Hi Team,
Can you please send me the table syntaxes for these tables.
please provide data sets for all related videso
Can you provide a download of the Database you used for your videos. Thank you so much.
We will try to upload the sqls which can be used for practice.
Can u do it with multiple rows?
declare @cmd varchar(max) = 'select id'
select @cmd += replace(char(10)+',max(iif(name=''@name'',val,null)) @name','@name',name)
from (select distinct Name from temp_t1) t
set @cmd += ' from temp_t1 group by id'
print @cmd
exec(@cmd)
Won't work if a value is NULL. Better use "else Null" instead of "else ''"
thanks
Thank You!
thanks