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

ความคิดเห็น • 43

  • @LearnatKnowstar
    @LearnatKnowstar  2 ปีที่แล้ว

    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

  • @LearnatKnowstar
    @LearnatKnowstar  4 ปีที่แล้ว +3

    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!

  • @marshalljackson1385
    @marshalljackson1385 3 ปีที่แล้ว +2

    Thank you providing multiple methods of pivoting columns into rows. Very informative and useful.

  • @gbagba81
    @gbagba81 2 ปีที่แล้ว +3

    this is outstandingly perfect

  • @erikashantini8529
    @erikashantini8529 3 ปีที่แล้ว +2

    Thank you very much for this :) It saved me from a job request today big time!! Thank you!

  • @gulahmadfaizi6572
    @gulahmadfaizi6572 3 ปีที่แล้ว +2

    Thanks A lot Sister, Please keep it up. repsect from Afghanistan.

  • @roshninirmolia7440
    @roshninirmolia7440 11 หลายเดือนก่อน

    This is exactly what I was searching for. You made my day thank you so much

  • @bonghahn6610
    @bonghahn6610 ปีที่แล้ว +1

    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.

  • @shubhammalviya3001
    @shubhammalviya3001 2 ปีที่แล้ว +1

    Your voice is very sweet , Thanks for the explanation. Above approach is working on SQL server but not on Mysql please help.

  • @kristyowens2284
    @kristyowens2284 4 ปีที่แล้ว +2

    very nicely explained.

  • @8886naveen
    @8886naveen ปีที่แล้ว

    Very Informative. It helped me to solve my project requirement🤩

  • @shreddersengupta7384
    @shreddersengupta7384 4 ปีที่แล้ว +3

    This is great! keep up the good work.

  • @pritichauhan463
    @pritichauhan463 ปีที่แล้ว

    Thanks a lot for this efforts❤❤

  • @adarshsonare9049
    @adarshsonare9049 ปีที่แล้ว +1

    Thanks

  • @master_persi
    @master_persi 2 ปีที่แล้ว +1

    very helpful video.

  • @farooqkota8692
    @farooqkota8692 ปีที่แล้ว

    Thanks mam very helpful

  • @ahmadiyorismatov1971
    @ahmadiyorismatov1971 ปีที่แล้ว +1

    what is data type of [value] column . there is mixed number and letters

  • @chetankulkarni5
    @chetankulkarni5 3 ปีที่แล้ว +1

    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.

    • @LearnatKnowstar
      @LearnatKnowstar  3 ปีที่แล้ว

      Thanks for your suggestions. Will plan videos soon

  • @sourabhpatel3834
    @sourabhpatel3834 ปีที่แล้ว +1

    We can use pivot also?

  • @widzewisze8475
    @widzewisze8475 3 ปีที่แล้ว

    hi ; thanks for your video , but can you add another one about many rows ? ,i need help about n rows?

  • @rapthaduchandra1113
    @rapthaduchandra1113 11 หลายเดือนก่อน

    Hi Team,
    Can you please send me the table syntaxes for these tables.

  • @Tejailab
    @Tejailab 4 หลายเดือนก่อน

    please provide data sets for all related videso

  • @engp8691
    @engp8691 2 ปีที่แล้ว +1

    Can you provide a download of the Database you used for your videos. Thank you so much.

    • @LearnatKnowstar
      @LearnatKnowstar  2 ปีที่แล้ว +1

      We will try to upload the sqls which can be used for practice.

  • @akhildas3743
    @akhildas3743 3 ปีที่แล้ว +1

    Can u do it with multiple rows?

    • @user-mf8gg8dj4x
      @user-mf8gg8dj4x 2 ปีที่แล้ว

      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)

  • @klavesin
    @klavesin 2 ปีที่แล้ว +1

    Won't work if a value is NULL. Better use "else Null" instead of "else ''"

  • @ramzamthel8014
    @ramzamthel8014 11 หลายเดือนก่อน

    thanks

  • @fernandosouza9678
    @fernandosouza9678 2 ปีที่แล้ว

    thanks