What is a from the query

Hi guys, I have almost finished the SQL basics and now moved on to the Subqueries
But I don’t understand what this ‘a’ from a.dep_month stands for
I know that this place is for table_name.column_name

but when i look at two tables from the example
dep_month column belongs to ‘flights’ table, not airports.

so i don’t know why it is written as ‘a’.
shouldn’t it be ‘flights.dep_month’ ??

SELECT a.dep_month,
a.dep_day_of_week,
AVG(a.flight_count) AS average_flights
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;

the exercise came from the link below
" https://www.codecademy.com/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-iii "

It’s an alias from the inner query.

At the bottom of that step, there are links to further explain:

Which takes you here:

2 Likes

Thank you !
Silly of me, i was so frustrated and wasnt thinking about looking at that.

1 Like