Your question is Top Content by Unique Viewers. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Paramount+ analytics needs a quarterly ranking of content performance. Write a PostgreSQL query that identifies the five content pieces with the most unique viewers during Q2 2025, from April 1 through June 30.
content_catalog with viewing_events using content_id.viewed_at is on or after 2025-04-01 and before 2025-07-01.viewer_id values for each content piece.content_id ascending as a deterministic tie-breaker.| Column | Type | Description |
|---|---|---|
| content_idPK | INTEGER | Unique content identifier |
| title | VARCHAR(150) | Paramount+ content title |
| content_type | VARCHAR(30) | Movie, series, or special |
| release_date | DATE | Original release date |
| genre | VARCHAR(50) | Primary genre |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique viewing event identifier |
| content_id | INTEGER | Referenced content identifier |
| viewer_id | INTEGER | Viewer identifier |
| viewed_at | TIMESTAMP | Viewing timestamp |
| surface | VARCHAR(30) | Paramount+ viewing surface |