Filter dim_hcp on a TEXT specialty column. Cardiologists are the highest-priority audience for the Cardiozin launch; pulling the cardiology subset is the first step before any targeting or call planning.
Brand asked me to count our cardiology HCPs before the field force gets the Cardiozin call list. From dim_hcp, give me every HCP whose specialty is 'Cardiology' — name, decile, target flag, and territory. Sort by decile descending so the top-tier prescribers lead, then alphabetical on hcp_name as a stable tiebreaker. The specialty column is TEXT and case-sensitive; use the exact 'Cardiology' string.
| Column | Type | Key |
|---|---|---|
| npi | TEXT | PK |
| hcp_name | TEXT | |
| specialty | TEXT | |
| decile | INT | |
| is_target | INT | |
| territory_id | INT | FK → dim_geography |
Each hint you reveal reduces the XP you can earn. Try the query first.
Single-table SELECT with a WHERE filter. dim_hcp has the specialty column; filter to the 'Cardiology' literal exactly (capital C, no plural).
No aggregation — one row per cardiology HCP. Project the four columns Riley named (hcp_name, decile, is_target, territory_id).
Stable two-level sort: top-decile cardiologists need to lead the call list, with an alphabetic tiebreaker so the order doesn't shuffle when 5+ HCPs share a decile.