The BlueLabs Activity Insights surface needs a daily engagement trend for each user. Write a PostgreSQL query that calculates a rolling three-calendar-day average of activity.
user_id, user_name, activity_date, and the rounded average, ordered by user and date.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| interaction_idPK | INTEGER | Unique interaction identifier |
| user_id | INTEGER | References users.user_id |
| interaction_date | DATE | Calendar date of the interaction |
| activity_count | INTEGER | Number of activities in the interaction record |