-
-
Save codecademydev/a57ff377c23cf4afc031b17f2276eb4b 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) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE countries.continent = 'Oceania' AND population_years.year = 2005; | |
SELECT AVG(population) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE countries.continent = 'South America' AND population_years.year = 2003; | |
SELECT name,MIN(population) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE population_years.year = 2007; | |
SELECT AVG(population) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE countries.name = 'Poland'; | |
SELECT COUNT(*) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE countries.name LIKE '%The%'; | |
SELECT countries.continent,SUM(population_years.population) | |
FROM population_years JOIN countries | |
ON population_years.country_id = countries.id | |
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