Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 27, 2020 03:00
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/fbc332bf57ccb588ec086d1a6f812561 to your computer and use it in GitHub Desktop.
Save codecademydev/fbc332bf57ccb588ec086d1a6f812561 to your computer and use it in GitHub Desktop.
Codecademy export
SELECT COUNT(*) FROM countries WHERE continent = 'Africa';
SELECT ROUND(SUM(population),2) FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE year = 2005 AND countries.continent = 'Oceania';
SELECT ROUND(AVG(population),2) FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE year = 2003 AND countries.continent = 'South America';
SELECT * FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE year = 2007 AND population IS NOT NULL ORDER BY population ASC LIMIT 1;
SELECT ROUND(AVG(population),2) FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE countries.name = 'Poland';
SELECT count(*) FROM countries WHERE name LIKE '% The %' OR name LIKE 'The %' OR name LIKE '% The' ;
SELECT continent, ROUND(SUM(population),2) FROM population_years JOIN countries ON population_years.country_id = countries.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