Your question is Top 5 Users Per Category. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a table of user activity, how would you identify the top 5 users per category?
Use the provided users and user_activity tables. Treat the number of activity records as each user's activity total. Exclude rows with a NULL category. Break ties by ascending user_id.
category, user_id, user_name, activity_count, and category_rank.category, category_rank, and user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | Display name of the user |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity record identifier |
| user_id | INT | User who generated the activity |
| category | VARCHAR(50) | Activity category |
| activity_at | TIMESTAMP | Timestamp when the activity occurred |