Nielsen Digital Content Ratings analysts need to understand how long each user spends consuming digital content. A session is defined as the elapsed time between page_load and page_exit for a page view.
Write a PostgreSQL query that calculates the average completed session duration for every user.
page_exit or with page_exit earlier than page_load.NULL.user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| session_idPK | INTEGER | Unique page-view identifier |
| user_id | INTEGER | References users.user_id |
| page_url | TEXT | Page visited |
| page_load | TIMESTAMP | Page load timestamp |
| page_exit | TIMESTAMP | Page exit timestamp |