Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 5, 2020 10:29
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/4da9f28c0133440e93fd37a92eddad4c to your computer and use it in GitHub Desktop.
Save codecademydev/4da9f28c0133440e93fd37a92eddad4c to your computer and use it in GitHub Desktop.
Codecademy export
select * from countries limit 5;
select * from population_years limit 5;
select count(*) from countries where continent like 'Africa';
select sum(population) from countries join population_years on countries.id = population_years.country_id where continent = 'Oceania' and year = '2005' group by continent;
select avg(population) from countries join population_years on countries.id = population_years.country_id where continent = 'South America' and year = 2003;
select countries.name, min(population) from countries join population_years on countries.id = population_years.country_id where year = 2007;
select avg(population) from countries join population_years on countries.id = population_years.country_id where name = 'Poland';
select count(distinct name) from countries where name like '%The%';
select continent, sum(population) from countries join population_years on countries.id = population_years.country_id where year = 2010 group by continent ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment