Back to Editor

Solution: 30. Video Count by Year

Medium

Problem Detail:

Write a SQL query to count how many videos were published each year.

Answer SQL Query:

SELECT YEAR(published_at) AS publish_year,
       COUNT(*) AS total_videos
FROM videos
GROUP BY YEAR(published_at)
ORDER BY publish_year;
You can easily copy this solution, switch back to your editor tab, paste it, and run the SQL!