Your question is Top 5 Users by Activity. 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.
Tech(x) wants to identify its most active users in the Tech(x) product during January 2025. Write a PostgreSQL query that includes users with no qualifying activity, counts their activity events, and returns the top five users.
2025-01-01 00:00:00+00 through 2025-01-31 23:59:59+00.LEFT JOIN so users without qualifying activity remain eligible with an activity count of zero.user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique Tech(x) user identifier |
| username | VARCHAR(100) | Tech(x) account name |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INTEGER | Unique activity event identifier |
| user_id | INTEGER | User associated with the activity event |
| event_type | VARCHAR(50) | Type of Tech(x) activity |
| occurred_at | TIMESTAMPTZ | Timestamp when the activity occurred |