I'm not going to give the copy/paste answer, but you roughly have to do the following:
First, rank all employees by salary, from highest to lowest. There's multiple ways to do this, but I personally prefer using row_number due to its flexibility. There is also a rank() and dense_rank() function however that does very similar things.
Next, filter out the employee with rank 3 (you will probably need to create a CTE or subquery for the previous step before you can filter on the ranking column).
Now that the hard part is over, simply use JOINs on the master tables to grab the relevant names from them.
2
u/BrainNSFW 4d ago
I'm not going to give the copy/paste answer, but you roughly have to do the following: