Created
March 26, 2020 20:56
-
-
Save wolframalexa/6bef9bf968486ca3ab0f156532affae2 to your computer and use it in GitHub Desktop.
SQL Countries of the World Project on Codecademy
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(id) 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 year = 2005; | |
SELECT AVG(population) FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE countries.continent = 'South America' AND year = 2003; | |
SELECT countries.name FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE population_years.year = 2007 ORDER BY population ASC LIMIT 1; | |
SELECT AVG(population) FROM population_years JOIN countries ON population_years.country_id = countries.id WHERE countries.name = 'Poland'; | |
SELECT * FROM countries WHERE name LIKE '%The%'; | |
SELECT countries.continent, SUM(population) FROM population_years JOIN countries ON population_years.country_id = countries.id GROUP BY countries.continent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment