Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 24, 2020 10:05
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/2cbcd97d9e777984f68b97154ad33832 to your computer and use it in GitHub Desktop.
Save codecademydev/2cbcd97d9e777984f68b97154ad33832 to your computer and use it in GitHub Desktop.
Codecademy export
select * from countries limit 10;
select * from population_years limit 10;
select count(*) from countries where continent = 'Africa';
select continent, sum(population), year from countries join population_years on countries.id = population_years.country_id where year = 2005 and continent = 'Oceania';
select continent, avg(population), year from countries join population_years on countries.id = population_years.country_id where year = 2003 and continent = 'South America';
select name, min(population), year from countries join population_years on countries.id = population_years.country_id where year = 2007;
select name, avg(population) from countries join population_years on countries.id = population_years.country_id where name = 'Poland';
select count(*) from countries where name like 'The %' or name like '% The';
select continent, sum(population), year 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