Chapter 9 · Interview Level
56. Department Budget Utilization
Hard40 XPHealthcare
Compare each department's total doctor salaries to its budget. Return the department name, budget, total salary cost, and the percentage of budget used (salary / budget * 100). Round to 1 decimal place. Order by utilization descending.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- specialtyTEXT
- FKdepartment_id→ departments.idINT
- emailTEXT
- phoneTEXT
- hire_dateTEXT
- salaryREAL
- PKidINT
- nameTEXT
- floorINT
- FKhead_doctor_id→ doctors.idINT
- budgetREAL
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.