Your question is Department Cost Totals by Join. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
At Northstar Analytics, finance tracks department spending in a separate expense table. Write a SQL query to join the department and expense data and return the total cost for each department.
departments and expenses using the department key.cost values.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| region | VARCHAR(50) | Region assigned to the department |
| Column | Type | Description |
|---|---|---|
| expense_idPK | INT | Unique expense identifier |
| department_id | INT | Department linked to the expense |
| expense_type | VARCHAR(50) | Category of expense |
| cost | DECIMAL(10,2) | Expense amount |