RienSQL
TASK #195 · Medium

The dashboard overstates department headcount

Your brief
For three days the dashboard has overstated department headcount. The report has the right number of departments and the order totals are correct: only the headcount is off, and the more orders a department has, the worse it gets.

Output name (department name), employees_count (number of employees) and total_amount (their order total).
Expected columnsname employees_count total_amountCompany
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
departmentsid, name
employeesid, name, department_id, manager_id, salary, hired_at
customersid, name, registered_at
ordersid, customer_id, employee_id, amount, created_at
loginsuser_id, logged_at