The code for CounOfOrdersByYear.sql is: SELECT YEAR(orderDate) AS year, COUNT(orderNumber) FROM orders GROUP BY # year # This works in MySQL but is not standard SQL. YEAR(orderDate) # This works in all SQL databases that follow the standard. ;