Use COUNT to aggregate rows in a fact table
quick — how many total encounters do we have on record? just one number. board wants volume stats by noon.
| Column | Type | Key |
|---|---|---|
| encounter_id | INT | PK |
| patient_id | INT | FK → dim_patients |
| provider_id | INT | FK → dim_providers |
| department_id | INT | FK → dim_departments |
| admit_date | TEXT | |
| discharge_date | TEXT | |
| diagnosis_code | TEXT | |
| diagnosis_description | TEXT | |
| encounter_type | TEXT | |
| discharge_disposition | TEXT |
Each hint you reveal reduces the XP you can earn. Try the query first.
Each row in `fact_encounters` represents one patient encounter. You need a single number summarizing every row
This is an aggregate over the whole table — no grouping or filtering. Which aggregate function tallies rows?
`SELECT ___(*) AS total_encounters FROM fact_encounters` — what aggregate goes in the blank?