Taboola wants to identify highly engaged users of Taboola Ads Manager. A Good User is a user whose average number of sessions per observed week is at least 3. Calculate the average session duration for each Good User.
Write a PostgreSQL query using the sessions table.
userId and calendar week, where weeks begin on Monday.userId and their average session duration across all recorded sessions.userId or null data_timestamp. PostgreSQL's AVG should ignore null durations.userId in ascending order.| Column | Type | Description |
|---|---|---|
| IdPK | INTEGER | Unique session identifier |
| userId | INTEGER | Taboola Ads Manager user identifier |
| duration | INTEGER | Session duration in seconds |
| data_timestamp | TIMESTAMP | Timestamp when the session was recorded |