Databases Reference
In-Depth Information
table. The first part of her query is straightforward. It is a SELECT from the
COUNTRIES table:
select country_id, country_name from countries;
CO COUNTRY_NAME
-- ----------------------------------------
AR Argentina
AU Australia
BE Belgium
BR Brazil
CA Canada
CH Switzerland
CN China
DE Germany
DK Denmark
EG Egypt
FR France
HK HongKong
IL Israel
IN India
IT Italy
JP Japan
KW Kuwait
MX Mexico
NG Nigeria
NL Netherlands
SG Singapore
UK United Kingdom
US United States of America
ZM Zambia
ZW Zimbabwe
25 rows selected.
The second part is a bit trickier. She needs to subtract the countries in which the
departments reside. The DEPARTMENTS table does not have a COUNTRY_ID column,
but it does have a LOCATION_ID column. The LOCATIONS table has a COUNTRY_ID
column, so Janice will need to join the DEPARTMENTS and LOCATIONS tables to get
the list of countries with departments:
select distinct country_id
from departments d, locations l
Search WWH ::




Custom Search