AnalystPath

Top Reviewer and Best Episode

SQLMediumMid level~15 min

Problem

Table: `Episode`

```text
+------------+---------+
| Column | Type |
+------------+---------+
| episode_id | int |
| episode | varchar |
+------------+---------+
episode_id is the primary key.
```

Table: `Listener`

```text
+-------------+---------+
| Column | Type |
+-------------+---------+
| listener_id | int |
| handle | varchar |
+-------------+---------+
listener_id is the primary key.
```

Table: `Review`

```text
+-------------+---------+
| Column | Type |
+-------------+---------+
| episode_id | int |
| listener_id | int |
| stars | int |
| posted_on | date |
+-------------+---------+
Each row is one listener's star score for one episode on a date.
```

Return a single column named `result` containing exactly two rows:

1. The `handle` of the listener who posted the **most reviews** overall. Break ties by the handle that is alphabetically smallest.
2. The `episode` with the **highest average score** among reviews posted in **April 2021** (`2021-04-01` to `2021-04-30`). Break ties by the episode name that is alphabetically smallest.

**Example**

```text
If 'mara_k' posted the most reviews, and episode 'Tidewater' had the best
April average, the output is two rows: 'mara_k' then 'Tidewater'.
```

Tables

Example rows — the live problem includes the full dataset.

Episode
episode_idepisode
1Tidewater
2Static Bloom
Listener
listener_idhandle
1mara_k
2devon
Review
episode_idlistener_idstarsposted_on
1152021-04-03
2142021-04-10
1252021-04-12

Expected output

Your answer should return 2 rows with the columns result.

Starter code (SQL)

SELECT *
FROM Episode;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions