[SQL] “Workers with the highest salaries” – Amazon
In the intricate landscape of SQL interviews, the ability to navigate through relational databases is often tested through challenging questions that demand both proficiency and creativity. Today, let’s delve into an intriguing SQL interview question that ventures into the realms of joining tables and employing subqueries.
You can find the puzzle here.
And this would be the solution for it:
SELECT t.worker_title
FROM worker w
JOIN title t
ON w.worker_id = t.worker_ref_id
WHERE w.salary = (SELECT MAX(salary) FROM worker)
Here you find a complete walkthrough of the solution: