SQL: Table Transformation 4. Non-correlated subqueris III


#1


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


Error CODE: "Use the select statement to view the table"
"Error: near line 2: no such column: a.flight_distance"


SELECT * FROM flights;
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,
  								COUNT(*) AS
  flight_count
  						FROM flights
  						GROUP BY 1,2,3
  ) a
  GROUP BY 1,2
  ORDER BY 1,2;


Thanks


#2

@andresgardiol,
Maybe you should have a look at the tables and column-names
using
+++ show all table defintions
select * from sqlite_master;


#3