Solution: 36. Total Likes by Channel
Medium
Problem Detail:
Write a SQL query to find the total number of likes received by each channel across all its videos.
Answer SQL Query:
SELECT c.channel_name,
SUM(s.like_count) AS total_likes
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_likes DESC;
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!