• + 0 comments

    select max(case when t.occupation ='Doctor' then t.name end) as Doctor, max(case when t.occupation ='professor' then t.name end ) as professor, max(case when t.occupation ='singer' then t.name end) as singer, max(case when t.occupation ='actor' then t.name end) as actor from ( select occupation ,name , row_number() over (partition by occupation order by name) as rn from occupations ) as t group by rn