Solution: 48. Monthly Upload Trend by Channel
Hard
Problem Detail:
Write a SQL query to find the number of videos uploaded by each channel in each month.
Answer SQL Query:
SELECT channel_id,
DATE_FORMAT(published_at, '%Y-%m') AS publish_month,
COUNT(*) AS total_videos
FROM videos
GROUP BY channel_id, DATE_FORMAT(published_at, '%Y-%m')
ORDER BY channel_id, publish_month;
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!