• + 0 comments
    create view VV as (
     select case when occupation = 'Doctor' then name END As Doctor,
        case when occupation = 'P``rofessor' then name END As Professor,
        case when occupation = 'Singer' then name END As Singer,
        case when occupation = 'Actor' then name END As Actor, 
        
          ROW_NUMBER() OVER (PARTITION BY occupation ORDER BY name) AS row_num from occupations);
        
        select max(Doctor), max(Professor), max(Singer), max(Actor) from VV group by row_num;