We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
select min(if(occupation='Doctor',name,null)),min(if(occupation='Professor',name,null)),min(if(occupation='Singer',name,null)),min(if(occupation='Actor',name,null)) from (select row_number() over(partition by occupation order by name) as rowss, name,occupation from occupations )as new
group by rowss;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Occupations
You are viewing a single comment's thread. Return to all comments →
select min(if(occupation='Doctor',name,null)),min(if(occupation='Professor',name,null)),min(if(occupation='Singer',name,null)),min(if(occupation='Actor',name,null)) from (select row_number() over(partition by occupation order by name) as rowss, name,occupation from occupations )as new group by rowss;