Sub-depts (parent 5–8): salary ≥100000, hired since Sep 2025
Level: Middle100 XP
Instructions
For each department (departments) whose parent_id is from 5 to 8 inclusive, select id, name and staff_cnt, the number of employees (employees.department_id = departments.id, dismissed ones count too) with salary at least 100000, hired on or after September 1, 2025 (hired_at). Departments with no such employees must appear in the result with the value 0. 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.