-
-
Save codecademydev/3a5ccea0185d27d14a67c0c9ed6f26ea 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(*) from countries where continent = 'Africa'; | |
select countries.continent, population_years.year, SUM(population_years.population) as 'Total_population' | |
from countries | |
join population_years on countries.id = population_years.country_id | |
where countries.continent = 'Oceania' and population_years.year = 2005; | |
select countries.continent, population_years.year, AVG(population_years.population) AS 'Avg_population' | |
from countries | |
join population_years on countries.id = population_years.country_id | |
where countries.continent = 'South America' and population_years.year = 2003; | |
select countries.continent, population_years.year, MIN(population_years.population) AS 'Min_population' | |
from countries | |
join population_years on countries.id = population_years.country_id | |
where population_years.year = 2007; | |
select countries.name, population_years.year, AVG(population_years.population) AS 'Avg_population' | |
from countries | |
join population_years on countries.id = population_years.country_id | |
where countries.name = 'Poland' group by 2 order by 2; | |
select name, count(*) from countries where name like '%The%' group by 1; | |
select countries.continent, population_years.year, SUM(population_years.population) as 'Total_population' | |
from countries | |
join population_years on countries.id = population_years.country_id | |
where population_years.year = 2010 group by 1; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment