Documentary Heavy Viewers
Problem
**[Asked at Netflix]**
Netflix's content team wants to target viewers who watch a lot of documentaries.
Find all users who have watched **more than 3 hours** of documentaries in total.
Return `user_id` and `documentary_hours` (rounded to 2 dp), ordered by hours descending.
Tables
Example rows — the live problem includes the full dataset.
shows
| show_id | title | genre |
|---|
viewing_history
| view_id | user_id | show_id | hours_watched |
|---|
Expected output
Your answer should return 3 rows with the columns user_id, documentary_hours.
Starter code (SQL)
SELECT *
FROM shows;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