#22 Occupations (Using Pivot ) | HackerRank SQL Solutions

แชร์
ฝัง

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

  • @vijayragav1865
    @vijayragav1865 3 หลายเดือนก่อน +2

    I think you can start ending each query with "';" because in oracle sql it is necessary as far as i remember.

  • @bibhutibaibhavbora8770
    @bibhutibaibhavbora8770 3 หลายเดือนก่อน

    Bhai ye query only oracle pe chalta hain MySQL pe nhi kyuki pivot function directly support nhi karta MySQL main!

  • @mohammadsahil5843
    @mohammadsahil5843 5 วันที่ผ่านมา

    how about this approch
    SELECT
    MAX(CASE WHEN Occupation = 'Doctor' THEN Name ELSE NULL END) AS Doctor,
    MAX(CASE WHEN Occupation = 'Professor' THEN Name ELSE NULL END) AS Professor,
    MAX(CASE WHEN Occupation = 'Singer' THEN Name ELSE NULL END) AS Singer,
    MAX(CASE WHEN Occupation = 'Actor' THEN Name ELSE NULL END) AS Actor
    FROM
    OCCUPATIONS
    GROUP BY
    Name
    ORDER BY
    Name;

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

    great

  • @tejaswibhargava8745
    @tejaswibhargava8745 ปีที่แล้ว +5

    Your efforts are great! but unfortunately, the explanation of concepts is unorganized which I am sure you can explain way better once mapped. All the best :)

    • @vivekjoshi3769
      @vivekjoshi3769 8 หลายเดือนก่อน

      Can you explain what you mean by "You can explain way better once mapped"?
      I watched his solution. It seems too hard for me.

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

    Why max(name) is used here

    • @AR-zd2hx
      @AR-zd2hx 4 หลายเดือนก่อน

      to make it in an agregate clause format so that we dont have to use the column names in group by clause else it will deliver a undesired output

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

    can we solve this in mysql....i can see that you are using oracle.