AVG(r.flight_count) AS average_flights
from (SELECT dep_month,
COUNT(*) AS flight_count
where dep_day_of_week ='Friday'
GROUP BY 1,2,3) r
GROUP by 1
we can choose any name , here i choose r as a temporary table , in the given solution they choose a as a name of this table , but we ask as the AVG of flight per month for every Friday , so we need this condition ( where dep_day_of_week ='Friday')
i hope that i give you some explanation