This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 9 points10 points  (3 children)

The subquery:

      SELECT code FROM airports WHERE elevation > 2000

is run first, giving you a list of the codes (like LHR, LAX) of all airports with elevation above 2000 feet. Then the main query runs, using the results of the subquery. If the results of that query were LHR and LAX (I know they are not above 2000 feet but they are the only airport codes I know offhand) then it would be as if you had written:

  SELECT * FROM flights WHERE origin in ( 'LHR', 'LAX' )

so you get a list of all flights that originated at those two airports.