0% found this document useful (0 votes)
2K views3 pages

SQL - Select Within Select

List each country name where the population is larger than 'russia' List the name and region of countries in the regions containing 'India', 'Iran' well Done, that is correct.

Uploaded by

api-3732352
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views3 pages

SQL - Select Within Select

List each country name where the population is larger than 'russia' List the name and region of countries in the regions containing 'India', 'Iran' well Done, that is correct.

Uploaded by

api-3732352
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

SELECT within SELECT

1a. List each country name where the population is larger than 'Russia'
bbc(name, region, area, population, gdp)

SELECT name FROM bbc


WHERE population>
(SELECT population FROM bbc
WHERE name='Russia')

NAME
Bangladesh
Brazil
China
India
Indonesia
Pakistan
United States of America

1b. List the name and region of countries in the regions containing 'India', 'Iran'.

select name, region from bbc where region in (select region from bbc where
name in ('India' , 'Iran'))

Well Done, that is correct.


NAME REGION
Afghanistan South Asia
Algeria Middle East
Bahrain Middle East
Bangladesh South Asia
Bhutan South Asia
Egypt Middle East
India South Asia
Iran Middle East
Iraq Middle East
Israel and Palestinian territories Middle East
Jordan Middle East
Kuwait Middle East
Lebanon Middle East
Mauritania Middle East
Morocco Middle East
Nepal South Asia
Oman Middle East
Pakistan South Asia
Qatar Middle East
Saudi Arabia Middle East
Sri Lanka South Asia
Sudan Middle East
Syria Middle East
The Maldives South Asia
Tunisia Middle East
United Arab Emirates Middle East
Yemen Middle East

1c. Show the European countries with a per capita GDP greater than 'United
Kingdom'.

select name from bbc where region='Europe' and gdp / population > (select
gdp/population from bbc where name ='United Kingdom')

Well Done, that is correct.


NAME
Denmark
Iceland
Ireland
Luxembourg
Norway
Sweden
Switzerland

1d. Which country has a population that is more than Canada but less than
Algeria?
select name from bbc where population > (select population from bbc where
name='Canada') and population < (select population from bbc where
name='Algeria')

Well Done, that is correct.


NAME
Kenya

You might also like