Use common table expressions and window functions to identify the top three most active users in each region on LinkedIn.
Count every activity event associated with a user. Users without activity should not appear, and ties should be resolved by the smaller user ID.
region, user_id, full_name, activity_count, and activity_rank.region, activity_rank, then user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique LinkedIn user identifier |
| full_name | VARCHAR(100) | User's display name |
| region | VARCHAR(50) | User's geographic region |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User associated with the activity event |
| event_type | VARCHAR(50) | Type of LinkedIn activity |