Salary growth of 5%+: departments 4–11, Jul 2022–Jun 2024
Instructions
Consider the salary_history records with changed_at on or after July 1, 2022 and strictly before July 1, 2024. For each employee who has such records, take the earliest salary by date (first_salary) and the latest by date (last_salary) among them. Find employees of the departments with department_id from 4 to 11 inclusive whose last_salary grew relative to first_salary by at least 5% (last_salary >= first_salary * 1.05). Output id, name, first_salary, last_salary and growth_pct, the growth as a percentage of first_salary, rounded to 1 decimal place. 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
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
Select a table in the diagram or list to view its rows.