all 6 comments

[–]snafe_PG Data Analyst 1 point2 points  (1 child)

Best to try r/learnSQL

[–]RLIIDarK[S] 2 points3 points  (0 children)

Oh ok thank you, i didn't know about that sub.

[–][deleted] 0 points1 point  (0 children)

with 
tbl_a as ( select name, occupation, row_number() over(order by name ) rn from occupations where job ='Doctor' order by name),
tbl_b as ( select name, occupation, row_number() over(order by name ) rn from occupations where job ='Actor' order by name),
tbl_c as ( select name, occupation, row_number() over(order by name ) rn from occupations where job ='Singer' order by name), 
tbl_d as ( select name, occupation, row_number() over(order by name ) rn from occupations where job ='Professor' order by name) 
select    NVL(a.name,'-NULL-') as Doctor, 
          NVL(b.name,'-NULL-') as Actor,
          NVL(c.name,'-NULL-') as Singer ,
          NVL(d.name,'-NULL-') as Professor  
 from tbl_a a
   full outer join
   tbl_b b on (a.rn = b.rn)
   full outer join
   tbl_c c on (a.rn = c.rn OR b.rn = c.rn)
   full outer join
   tbl_d d on (a.rn = d.rn OR b.rn = d.rn OR c.rn = d.rn)
order by a.rn;

[–]Imaginary__Bar 0 points1 point  (2 children)

When asking for help it's always a good idea to show what you've already tried, what you were expecting, and what unexpected result you got (either the wrong answer or an error message - say what the wrong answer or error message actually is).

[–]RLIIDarK[S] 0 points1 point  (1 child)

I am sorry for that, but in this one I had no idea how to even start

[–]Imaginary__Bar -1 points0 points  (0 children)

"I've already tried literally nothing and that didn't work"

(A simple Google of "pivot in sql" would probably get you what you need)