-
-
Save codecademydev/28d76c69db46f59e259728c56ebf66e8 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select count(*) [Africa_entries] | |
from countries | |
where continent = 'Africa'; | |
select sum(population) [total_pop] | |
from countries c | |
inner join population_years p on c.id = p.country_id | |
where c.continent = 'Oceania'; | |
select avg(population) [avg_pop] | |
from countries c | |
inner join population_years p on c.id = p.country_id | |
where c.continent = 'South America'; | |
select c.name, p.population | |
from countries c | |
inner join population_years p on c.id = p.country_id | |
where p.year = '2007' | |
and p.population = (select min(population) from population_years where year = '2007'); | |
select c.name, avg(p.population) [avg_pop] | |
from countries c | |
inner join population_years p on c.id = p.country_id | |
where c.name = 'Poland'; | |
select count(*) [we_countries] | |
from countries | |
where countries.name like '% The%'; | |
select c.continent, sum(p.population) [total_pop] | |
from countries c | |
inner join population_years p on c.id = p.country_id | |
where p.year = '2010' | |
group by c.continent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment