Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 4, 2020 01:55
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/cbb1686470154a6271739e7350dd0f6b to your computer and use it in GitHub Desktop.
Save codecademydev/cbb1686470154a6271739e7350dd0f6b to your computer and use it in GitHub Desktop.
Codecademy export
SELECT COUNT(*) AS 'African Countries'
FROM countries
WHERE continent = 'Africa';
SELECT COUNT(population) AS "Oceania Pop. 2005"
FROM population_years
CROSS JOIN countries
WHERE continent = 'Oceania' AND year = 2005;
SELECT ROUND(AVG(population), 2) AS 'Averge Pop in Millions of SouthA.Countries 2003'
FROM population_years
CROSS JOIN countries
WHERE continent = 'South America' AND year = 2003;
SELECT name, ROUND(MIN(population), 4) AS 'Smallest Population in Millions'
FROM population_years
CROSS JOIN countries
WHERE year = 2007;
SELECT name, ROUND(AVG(population), 2) AS ' Average in Millions'
FROM population_years
CROSS JOIN countries
WHERE name = 'Poland';
SELECT COUNT(*) AS 'Number of countries with The in Name'
FROM countries
WHERE name LIKE '%The%';
SELECT continent, COUNT(population)
FROM countries
CROSS JOIN population_years
WHERE year = 2010
GROUP BY 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment