Healthcare Analytics Path · Mission 4 of 25Starter

Encounters by department

Use GROUP BY with COUNT and ORDER BY to find top values

Back to Healthcare Analytics

The Brief

Dr. Amara OkaforChief Quality Officerquality-analytics

Break down our encounter volume by department. I need department name and encounter count, sorted by volume descending. This tells me where our patients are going and where to focus the quality review.

You'll practice

GROUP BYJOINORDER BY

Tables available

fact_encountersdim_departments

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Department names live in `dim_departments`, encounter rows in `fact_encounters`. You'll need to connect them on `department_id`

Hint 2

You want one row per department with a count beside it, sorted with the busiest first. Think grouping + aggregation + ordering

Hint 3

`SELECT d.department_name, ___(*) AS encounter_count FROM fact_encounters e JOIN dim_departments d ON ___ GROUP BY ___ ORDER BY ___ DESC`