Your question is Rolling 30-Day Active Users SQL. 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.
Publicis Groupe analysts are evaluating regional engagement across a digital audience platform. Write a PostgreSQL query that measures distinct active users during the trailing 30-day window ending on 2024-02-01, assigns each region an engagement tier, and ranks regions within their tier.
users to user_activity while retaining regions whose users had no qualifying activity.High for at least 3 active users, Medium for 1 or 2, and Low for 0.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| region | VARCHAR(50) | Geographic region assigned to the user |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User associated with the activity event |
| activity_date | DATE | Calendar date on which the activity occurred |