Non-Correlated Subqueries I

When determining which airports are >2000 elevation, they used:
FROM airports
WHERE elevation > 2000;

  1. What is the significance of specifying the “code” column? This leads to my next question…

When determining which flights originated from airports>2000, they use:
FROM flights
WHERE origin in (
FROM airports
WHERE elevation > 2000);

The ‘origin’ from flights dictate a specific airport name while ‘code’ from airports dictate a specific airport. How are they connected/logic behind it?

1 Like

I think that the ‘code’ column in the ‘airports’ table is functionally equivalent to the ‘origin’ column in the ‘flights’ table. That is, every airport has a unique ‘code’ attached to it and every flight has a unique ‘origin’ defined by the ‘airports’ code.


I am a fellow learner, but I agree with kemini. My understanding is that the database is first going through the “airports” table and returning the “code” from all entries (airports) where the elevation is greater than 2000. The outer query then goes through “flights” and identifies which entries origins are contained in the list it created.

1 Like

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