Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 3, 2020 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/36b37a857fdb24bbe734f23b1755eb69 to your computer and use it in GitHub Desktop.
Save codecademydev/36b37a857fdb24bbe734f23b1755eb69 to your computer and use it in GitHub Desktop.
Codecademy export
select * from countries join population_years on
countries.id = population_years.country_id limit 5
;
select count (*) from countries
where continent ='Africa';
select count (continent) from countries join population_years on
countries.id = population_years.country_id
where continent ='Oceania'and year =2005
;
select avg (population) from countries join population_years on
countries.id = population_years.country_id
where continent = 'South America' and year =2003
;
select * from countries join population_years on
countries.id = population_years.country_id
where year =2007
group by name
order by population asc
limit 2
;
select avg (population) from countries join population_years on
countries.id = population_years.country_id
where name = 'Poland'
;
select count(name) from countries join population_years on
countries.id = population_years.country_id
where name like 'the %'
;
select continent,sum(population),year from countries join population_years on
countries.id = population_years.country_id
group by continent
having year=2010
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment