Write a query to identify our most active users over the last 30 days on Quizlet.
Treat each row in activity_events as one activity. Use the last 30 calendar days, including today, and return users with the three highest activity ranks. Users tied on activity count share a rank.
activity_rank, user_id, username, activity_count, and active_days.activity_rank, then activity_count descending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Quizlet user identifier |
| username | VARCHAR(100) | Quizlet username |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique activity event identifier |
| user_id | INT | User who generated the activity event |
| event_type | VARCHAR(50) | Type of Quizlet activity |
| occurred_at | TIMESTAMPTZ | Timestamp when the activity occurred |