Use GROUP BY to explore data distribution and spot inconsistencies
What's our payer mix? Show each insurance type and how many patients we have for each. This tells me a lot about our patient population — Medicare patients have very different needs from commercial insurance patients.
| Column | Type | Key |
|---|---|---|
| patient_id | INT | PK |
| first_name | TEXT | |
| last_name | TEXT | |
| date_of_birth | TEXT | |
| gender | TEXT | |
| insurance_type | TEXT | |
| zip_code | TEXT | |
| primary_language | TEXT | |
| is_deceased | INT |
Each hint you reveal reduces the XP you can earn. Try the query first.
Single-table aggregate over the patient dimension, grouped by payer.
GROUP BY the insurance column, COUNT per group, ORDER BY the count descending.
Don't normalize the casing yet — Dr. Okafor wants the raw payer mix as stored. The casing inconsistency is itself diagnostic.