Non correlated subquery II explanation


#1


https://www.codecademy.com/en/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-i


I can follow the directions and use the template to get the correct answer to advance past the lesson but no matter how many other forum threads I read, I'm still not understanding how we get to this answer.

In the code below, the nested query gets all 'codes' from the airports table where faa_region is set to aso. I get that. But then the top query gets all data from the flights row where origin is in the code list. I do not see how the two are related. I would've thought they would be linked by ID or something.



SELECT * 
FROM flights
WHERE origin in (
	SELECT code FROM airports
	WHERE faa_region = 'ASO');


#2

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