• + 1 comment

    wow, this was really tuf uwu :3

    with cte as (
        select name, occupation, row_number() over(partition by occupation order by name) as rn 
        from occupations
    )
    select
        max(case when occupation = 'Doctor' then name end) as Doctor,
        max(case when occupation = 'Professor' then name end) as Professor,
        max(case when occupation = 'Singer' then name end) as Singer,
        max(case when occupation = 'Actor' then name end) as Actor
    
    from cte
    group by rn;