/population_queries.sqlite Secret
Created
February 7, 2020 09:03
Star
You must be signed in to star a gist
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(*) | |
from countries | |
where continent = 'Africa'; | |
select sum(population_years.population) | |
from population_years | |
join countries | |
on population_years.country_id = countries.id | |
where population_years.year = 2005 | |
and countries.continent = 'Oceania'; | |
select round(avg(population_years.population),2) as 'Average Population in South America 2003' | |
from population_years | |
join countries | |
on population_years.country_id = countries.id | |
where population_years.year = 2003 | |
and countries.continent = 'South America'; | |
select min(population_years.population) as 'Population',countries.name | |
from population_years | |
join countries | |
where population_years.year = 2007; | |
select round(avg(population_years.population),2) as 'Avg Population in Poland' | |
from population_years | |
join countries | |
on population_years.country_id = countries.id | |
where countries.name = 'Poland'; | |
select distinct name, count(*) | |
from countries | |
where name like '%The%'; | |
SELECT DISTINCT countries.name | |
FROM countries | |
JOIN population_years | |
ON countries.id=population_years.country_id | |
WHERE countries.name LIKE '%The%'; | |
select sum(population_years.population),countries.continent | |
from population_years | |
join countries | |
on population_years.country_id = countries.id | |
where population_years.year = 2010 | |
group by 2; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment