Calculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.
the third quarter of year 2013 implies 3 month interval, including July, August, and September of 2013 and refers to date; the average usage of each bike = DIVIDE(SUM(duration), COUNT(bike_id)); the average wind direction = DIVIDE(SUM(wind_dir_degrees), COUNT(date));
SELECT AVG(T1.duration), AVG(T2.wind_dir_degrees) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), 1, INSTR(T2.date, '/') - 1) IN ('7', '8', '9') AND SUBSTR(CAST(T2.date AS TEXT), -4) = '2013'