Solution: 32. Top 10 Channels by Total Video Views
Medium
Problem Detail:
Write a SQL query to find the top 10 channels based on the total views accumulated by their videos.
Answer SQL Query:
SELECT c.channel_name,
SUM(s.view_count) AS total_video_views
FROM channels c
JOIN videos v
ON c.channel_id = v.channel_id
JOIN video_stats s
ON v.video_id = s.video_id
GROUP BY c.channel_id, c.channel_name
ORDER BY total_video_views DESC
LIMIT 10;
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!