Your question is 3-Month Rolling Average in 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.
The wants to monitor monthly engagement across its user-facing products. Write a PostgreSQL query that calculates each user's rolling average number of interactions for the three calendar months ending in April 2025.
user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| signup_date | DATE | Date the user registered |
| Column | Type | Description |
|---|---|---|
| interaction_idPK | INTEGER | Unique interaction identifier |
| user_id | INTEGER | User associated with the interaction |
| interaction_at | TIMESTAMP | Timestamp when the interaction occurred |
| interaction_type | VARCHAR(40) | Interaction category |