Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created March 31, 2020 08:45
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/e89a65cef164e51edd68f92733e73509 to your computer and use it in GitHub Desktop.
Save codecademydev/e89a65cef164e51edd68f92733e73509 to your computer and use it in GitHub Desktop.
Codecademy export
SELECT SUM(population_years.population) AS 'Total population'
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE countries.continent = 'Oceania'
AND population_years.year = 2005;
SELECT AVG(population_years.population) AS 'Population'
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE countries.continent = 'South America'
AND population_years.year = 2003;
SELECT MIN(population_years.population),
countries.name
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE population_years.year = 2007;
SELECT AVG(population_years.population)
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE countries.name = 'Poland';
SELECT name
FROM countries
WHERE name LIKE '%The%';
SELECT SUM(population_years.population),
countries.continent
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE population_years.year = 2010
GROUP BY 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment