Back to Editor

Solution: 42. Videos with Above-Average Views

Hard

Problem Detail:

Write a SQL query to find videos whose view_count is greater than the overall average video view count.

Answer SQL Query:

SELECT v.video_id, v.title, s.view_count
FROM videos v
JOIN video_stats s
  ON v.video_id = s.video_id
WHERE s.view_count > (
    SELECT AVG(view_count)
    FROM video_stats
);
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!