StreamWave tracks user activity across its app and wants a daily engagement trend. Write a SQL query to calculate the 7-day rolling average of daily active users.
A user is considered active on a given date if they generated at least one event that day. Use the event log and return one row per calendar date present in the data.
user_events table.user_id is NULL; those rows should not count toward active users.event_date, daily_active_users, and rolling_7_day_avg.event_date ascending.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event record ID |
| user_id | INT | User who generated the event; may be NULL for anonymous events |
| event_name | VARCHAR(50) | Type of user event |
| event_time | TIMESTAMP | Timestamp when the event occurred |