Solution: 43. Channels with Above-Average Channel Video Views
Hard
Problem Detail:
Write a SQL query to find channels whose average video views are greater than the overall average video views.
Answer SQL Query:
SELECT c.channel_name,
AVG(s.view_count) AS avg_channel_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
HAVING AVG(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!