SQL: Table Transformation #4 Subqueries lll


#1

I have reviewed my code with others who posted and I have the same thing but this lesson has a bug and will not let me get to next lesson?
This is getting a little frustrating as this is the second day with no support resolution...I'm kinda complaining but not really as I appreciate the best free online tutorial from Codecademy.....
Error Message:
"Use the Select statement to view the table"

Link:
https://www.codecademy.com/en/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-iii?action=resume

SELECT
a.dep_month, a.dep_day_of_week, AVG (a.flight_distance) AS
average_distance
FROM
( SELECT dep_month,
dep_day_of_week,
dep_date,
distance,
COUNT(*) AS flight_distance

FROM flights
GROUP BY 1, 2, 3) a
GROUP BY 1,2
ORDER BY 1,2;


#2

Try using SUM instead of COUNT - and you don't need distance above this line.

SELECT
a.dep_month, a.dep_day_of_week, AVG (a.flight_distance) AS
average_distance
FROM
( SELECT dep_month,
dep_day_of_week,
dep_date,
SUM(distance) AS flight_distance

FROM flights
GROUP BY 1, 2, 3) a
GROUP BY 1,2
ORDER BY 1,2;


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.