The monday Data Analytics team wants to understand which actions most often lead to a purchase in monday Work Management. Given ordered user events, write a PostgreSQL query that identifies the most common sequence of the three actions immediately preceding a purchase.
user_id and session_id, and order events chronologically using event_time and event_id as a tie-breaker.view_board > open_item > invite_member.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| user_id | INT | monday user identifier |
| session_id | VARCHAR(50) | Session containing the event |
| event_time | TIMESTAMP | Timestamp when the event occurred |
| action | VARCHAR(50) | Recorded user action |