Databases Reference
In-Depth Information
where d.location_id = l.location_id;
CO
--
CA
DE
UK
US
4 rows selected.
Janice realizes that she will also need the country name in the query for the
INTERSECT operation to work, so this query needs to have the COUNTRIES table
as part of the join:
select distinct c.country_id, country_name
from departments d, locations l, countries c
where d.location_id = l.location_id
and c.country_id = l.country_id;
CO COUNTRY_NAME
-- ----------------------------------------
CA Canada
DE Germany
UK United Kingdom
US United States of America
4 rows selected.
Janice can now bring it all together by using the MINUS operator to subtract
this query from the first query against the COUNTRIES table:
select country_id, country_name from countries
minus
select distinct c.country_id, country_name
from departments d, locations l, countries c
where d.location_id = l.location_id
and c.country_id = l.country_id;
CO COUNTRY_NAME
-- ----------------------------------------
AR Argentina
AU Australia
Search WWH ::




Custom Search