Instruction
You can use these functions with GROUP BY or HAVING. This is especially useful when preparing reports. The query below can be used to generate a report about the number of aircraft produced each month:
SELECT YEAR(ProducedDate) AS Year, MONTH(ProducedDate) AS Month, COUNT(Id) AS FlightsNumber FROM Aircraft GROUP BY YEAR(ProducedDate), MONTH(ProducedDate);
As you can see, rows are grouped by the extracted YEAR and MONTH values.
Exercise
The manager needs a report of the average delay, in minutes, of all flights for each year after 2014. Write the query for this report. Name the columns Year and AvgDelay.



