Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 5, 2020 13:44
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/4a9f027ed429732a7ff6afb2bc2cf2a5 to your computer and use it in GitHub Desktop.
Save codecademydev/4a9f027ed429732a7ff6afb2bc2cf2a5 to your computer and use it in GitHub Desktop.
Codecademy export
SELECT COUNT (*)
FROM countries
WHERE continent = 'Africa';
SELECT SUM(population)
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE year = '2005'
AND continent = 'Oceania';
SELECT ROUND(AVG(population), 2)
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE year = '2003'
AND continent = 'Oceania';
SELECT MIN(population), name
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE year = '2007';
SELECT ROUND(AVG(population), 2)
FROM population_years
JOIN countries
ON population_years.country_id = countries.id
WHERE name = 'Poland';
SELECT COUNT(name)
FROM countries
WHERE name LIKE '%The%';
SELECT continent, ROUND(SUM(population), 2) AS 'total population'
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