Netflix Customer Insights needs a ranked view of the titles watched most during the previous seven days. Write a PostgreSQL query using 2025-02-08 12:00:00 as the reference time so the result is reproducible.
Include streams that overlap the seven-day window from 2025-02-01 12:00:00 through the reference time. Calculate watch time in minutes, clip sessions to the window boundaries, treat a NULL end_time as still active at the reference time, and return the top five Netflix titles.
streams to shows to return the title.| Column | Type | Description |
|---|---|---|
| stream_idPK | INT | Unique stream session identifier |
| user_id | INT | Netflix member identifier |
| show_id | INT | Referenced title identifier |
| start_time | TIMESTAMP | Time at which the stream started |
| end_time | TIMESTAMP | Time at which the stream ended, null for an active session |
| Column | Type | Description |
|---|---|---|
| show_idPK | INT | Unique Netflix title identifier |
| title | VARCHAR(150) | Netflix show or series title |