from(select case when Occupation="Doctor" then (@r1:=@r1+1) when Occupation="Professor" then (@r2:=@r2+1) when Occupation="Singer" then (@r3:=@r3+1) when Occupation ...
select name [Professor],Row_number() over(order by name) [id] from OccuPATIONS where Occupation='Professor' ) as f left join ( select name [Actor],Row_number() over ...
Getting good at SQL for interviews can feel like a puzzle. You know the basics, but putting them together in a way that impresses people is another thing entirely. Luckily, there are great tools out ...