Non correlated sub queries II


#1

this is the example that was given, SELECT *
FROM flights
WHERE origin in (
SELECT code
FROM airports
WHERE fac_type = 'SEAPLANE_BASE');

and i was given this instruction

Using the same pattern, find flight information about flights where the Federal Aviation Administration region (faa_region) is the Southern region (ASO)..

this was my query

select * from flights where
(select code from airports where faa_region = 'aso');.

the system can't validate the query


#2

We are using SQLite

For an overview of the so-called SCHEMA defintion
select * from sqlite_master;

You have to undestand that
in the flights-Table you have the field origin
in the airports-Table you have the field code

select origin,carrier      /*select fields*/
from flights               /*from the flights-table*/
where  origin in           /*where the VALUE of the origin-field*/
(select code               /*can be found in the =list= of code-VALUES*/
from airports              /*found in the airports-Table*/
where faa_region = "ASO"); /*where the field faa_region */
                           /*has the upperCase-String-Value "ASO" */

To get a better feel

https://www.techonthenet.com/sqlite/in.php
https://stackoverflow.com/questions/10725901/select-query-by-pair-of-fields-using-an-in-clause
https://stackoverflow.com/questions/13027708/sql-multiple-columns-in-in-clause?noredirect=1&lq=1


#3

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