#22 Occupations (Using Pivot ) | HackerRank SQL Solutions #sql #oracle #pivot #hackerrank

preview_player
Показать описание
Check GroupBy Solution for same question here :

Copy code from here:

Please follow us

Thanks for watching us ...
Dev19🖤
Рекомендации по теме
Комментарии
Автор

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

vijayragav
Автор

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 :)

tejaswibhargava
Автор

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

bibhutibaibhavbora
Автор

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

Lastlaugh
Автор

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;

mohammadsahil
visit shbcf.ru