SELECT YEAR(publish_date) as publishYear, COUNT(*) AS totalRows FROM article GROUP BY YEAR(publish_date);
If you need to create a report where data is to be represented by year, you can use the built-in
YEAR() function in the
GROUP BY clause.
YEAR function returns the year for date, in the range 1000 to 9999, or 0 for the “zero” date.