-
-
Save codecademydev/6c3ef9ecbe850230a76180cd6a05a195 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) | |
FROM countries | |
WHERE continent = 'Africa'; | |
SELECT SUM(population_years.population) | |
AS 'Total population of Oceania in 2005' | |
FROM population_years | |
JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE continent = 'Oceania' and year = 2005; | |
SELECT ROUND(AVG(population_years.population)) | |
AS 'Avg. Population of South America in 2003' | |
FROM population_years | |
JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE continent = "South America" AND year = 2003; | |
SELECT MIN(population_years.population) | |
AS 'Smallest population in 2007', | |
countries.name | |
FROM population_years | |
JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE year = 2007; | |
SELECT AVG(population_years.population) | |
AS 'Avg. Population in Poland' | |
FROM population_years | |
JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE name = "Poland"; | |
SELECT COUNT(*) | |
FROM countries | |
WHERE name LIKE "%The%"; | |
SELECT countries.continent, | |
ROUND(SUM(population_years.population), 2) | |
AS 'Total population per continent in 2003' | |
FROM population_years | |
JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE year = 2010 | |
GROUP BY 1 | |
ORDER BY 2 DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment