Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 19, 2020 18:27
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/4d23ce3134f5357d6ff9a45329962131 to your computer and use it in GitHub Desktop.
Save codecademydev/4d23ce3134f5357d6ff9a45329962131 to your computer and use it in GitHub Desktop.
Codecademy export
SELECT COUNT(*)
FROM countries
WHERE continent = 'Africa';
SELECT SUM(population) AS 'Oceania 2005 population'
FROM countries
JOIN population_years
ON population_years.country_id = countries.id
WHERE continent = 'Oceania'
AND year = 2005;
SELECT AVG(population) AS 'South America Average Country Population 2003'
FROM countries
JOIN population_years
ON population_years.country_id = countries.id
WHERE continent = 'South America'
AND year = 2003;
SELECT name, MIN(population)
FROM countries
JOIN population_years
ON population_years.country_id = countries.id
WHERE year = 2007;
SELECT MIN(year), MAX(year)
FROM population_years;
SELECT AVG(population)
FROM countries
JOIN population_years
ON population_years.country_id = countries.id
WHERE name = 'Poland';**/
SELECT COUNT(*)
FROM countries
WHERE name LIKE '% The';
SELECT continent, SUM(population), year
FROM countries
JOIN population_years
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