SQL - Select Within Select
SQL - Select Within Select
1a. List each country name where the population is larger than 'Russia'
bbc(name, region, area, population, gdp)
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'))
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')
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')