Extract top-decile utilizing members using CTEs and ranking window functions.
Use the members and utilization_events tables. Calculate utilization from event units, include members with no events, and assign the highest-utilization decile deterministically.
member_id, member_name, utilization_events, total_utilization_units, utilization_rank, and utilization_decile.total_utilization_units descending, then member_id ascending.| Column | Type | Description |
|---|---|---|
| member_idPK | INT | Unique member identifier |
| member_name | VARCHAR(100) | Member display name |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique utilization event identifier |
| member_id | INT | Member associated with the event |
| service_date | DATE | Date of the utilization event |
| utilization_units | INT | Units attributed to the event |