-
-
Save codecademydev/09eb7aefed5a28bd3d182719ba3337f7 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(*) AS 'total countries from Africa' | |
FROM countries | |
WHERE continent = 'Africa'; | |
SELECT SUM(population) AS 'total population of the Oceania continent in 2005' | |
FROM countries | |
INNER JOIN population_years | |
ON countries.id = population_years.country_id | |
WHERE countries.continent = 'Oceania' | |
AND population_years.year = '2005'; | |
SELECT AVG(population) AS 'average population of South American countries in 2003' | |
FROM countries | |
INNER JOIN population_years | |
ON countries.id = population_years.country_id | |
WHERE countries.continent = 'South America' | |
AND population_years.year = '2003'; | |
SELECT name AS 'country with the smallest population', MIN(population) AS 'population' | |
FROM countries | |
INNER JOIN population_years | |
ON countries.id = population_years. country_id; | |
SELECT AVG(population) AS 'Average population of Poland 2000-2010' | |
FROM population_years | |
INNER JOIN countries | |
ON population_years.country_id = countries.id | |
WHERE name = 'Poland'; | |
SELECT name AS 'countries with "The"' | |
FROM countries | |
WHERE name LIKE '%The'; | |
SELECT SUM(population) AS 'total population of all countries' | |
FROM population_years | |
WHERE year = '2010'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment