2. Non-Correlated Subquiries


I'm interesting what the connection between the two tables 'flights' and 'airports'.
FROM flights
WHERE origin in (
FROM airports
WHERE elevation > 2000);

How we can use IN statement if we don't have any connection between tables 'flights and airports' .
How we can connect 'origin' and 'code'?
I look at the table and didn't see the connection.
Please explain me the connection maybe I missed something.


If you look at the Database definition with
+++ show all table defintions
select * from sqlite_master;

and then execute

SELECT code 
 FROM airports 
 WHERE elevation > 2000
limit 10;

you will get 10 airport FAA code's

These airport code's are used in the origin


So if I understand right. In the column "origin" from table "flight" we have the same information( flight detail) in cells! like in column "code" in table "airports". And elevation we use only for choosing less cells.

Funny I read very attentively and everything in the text )) "Next, we take the result set of the inner query and use it to filter on the flights table, to find the flight detail that meets the elevation criteria."

Thank you for your help)


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