UST's analytics platform needs a daily engagement metric that smooths short-term fluctuations. The metric must count registered active users with at least one activity event and calculate a rolling seven-day average.
Write a PostgreSQL query that returns results for January 1 through January 10, 2025.
account_status is active and who generated at least one event on each date.ROWS BETWEEN 6 PRECEDING AND CURRENT ROW.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique registered user identifier |
| account_status | VARCHAR(20) | Current account status, such as active or suspended |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User associated with the activity event |
| occurred_at | DATE | Calendar date when the event occurred |
| event_type | VARCHAR(30) | Type of platform activity |