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