I am understanding “origin” in the outer query is matching the faa_region in the inner query and it is producing the correct results.
SELECT *
FROM flights
WHERE origin in (
SELECT code
FROM airports
WHERE faa_region = 'ASO');
What I’m not understanding is why “code” is in the select clause of the inner query. What purpose does it serve? It doesn’t appear to match anything in the flights table.
@bcoble23,
With your SELECT code FROM airports WHERE faa_region = 'ASO'
you create a list SOUTHERN REGION. ALABAMA · FLORIDA · GEORGIA · KENTUCKY · MISSISSIPPI · NORTH-CAROLINA · SOUTH-CAROLINA · TENNESSEE.
represented by code
You then check if your flight starts from the origin Airport.
Have a look at the table-structures using
+++ show all table defintions
select * from sqlite_master;