Team costs more than manager x2.5, 4+ people
Level: MiddleTopic: CTE100 XP
Instructions
A manager's team is their direct reports (employees.manager_id = the manager's id), including those who were fired. Find managers (of any status) whose team has at least 4 people and whose team's total salary is strictly greater than the manager's own salary multiplied by 2.5. Output the manager's id, name and salary, as well as team_size and team_payroll. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Exactly oneZero or oneZero or more
Table relationships
- N:1Many-to-one
employees.→department_id departments.id - N:1Many-to-one
employees.→manager_id employees.id - N:1Many-to-one
departments.→parent_id departments.id - N:1Many-to-one
salary_history.→employee_id employees.id
Table data
PostgreSQL
Select a table in the diagram or list to view its rows.