Write a SQL query to find the top three most frequent events per user over a rolling 30-day window for Allen Integrated Solutions.
Use the events table. Treat each distinct user activity date as a window end date, include that date and the preceding 29 calendar days, exclude NULL event types, and break frequency ties alphabetically.
user_id, window_end_date, event_type, event_count, frequency_rank.user_id, window_end_date, and frequency_rank.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| user_id | INT | Identifier of the user who generated the event |
| event_type | VARCHAR(50) | Type of user event |
| occurred_at | TIMESTAMP | Timestamp when the event occurred |