Maximum total compensation
Question
You're given the following table showing information about employees at a company:
Table: emp_info
department | emp_id | salary_annual | bonus |
---|---|---|---|
eng | 1234 | 150000 | 20000 |
eng | 1235 | 125000 | 15000 |
eng | 1236 | 110000 | 17000 |
sales | 4454 | 110000 | 25000 |
sales | 4432 | 145000 | 7000 |
marketing | 4430 | 130000 | 12000 |
marketing | 1299 | 135000 | 18000 |
Using the table above, write a SQL query to return the emp_id of the employee with the highest total compensation. Make sure your query is able to handle potential ties (e.g. if there is a tie, should return all emp_ids that tie for the highest total compensation).
You can view/query the data in an interactive SQL fiddle here.