AnalystPath

Top Viewers by Watch Hours

SQLEasyJunior levelNetflix~15 min

Problem

**[Asked at Netflix]**

Netflix wants to identify its most active subscribers. Given a table of
viewing history and a table of subscribers, find the **top 3 users by
total hours watched** in March 2023.

Return `name` and `total_hours` (rounded to 2 dp),
ordered by total hours descending.

Tables

Example rows — the live problem includes the full dataset.

viewers
user_idnameplan
watch_history
watch_iduser_idshow_idhours_watchedwatched_at

Expected output

Your answer should return 3 rows with the columns name, total_hours.

Starter code (SQL)

SELECT *
FROM viewers;

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