Created
August 27, 2020 06:49
-
-
Save AlistairBrownlee/37c0df35bf5d33c6f0322e7daf737d8d to your computer and use it in GitHub Desktop.
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 COUNT(*) | |
FROM countries | |
WHERE continent = 'Africa'; | |
SELECT id, continent | |
FROM countries | |
GROUP BY continent; | |
SELECT * | |
FROM population_years | |
LIMIT 10; | |
SELECT SUM(population) AS 'Population of Oceana in 2005 (in millions)' | |
FROM population_years | |
WHERE year = 2005 AND country_id = 213; | |
SELECT countries.name, MIN(population_years.population) | |
FROM countries | |
JOIN population_years | |
ON countries.id = population_years.country_id | |
WHERE year = 2007; | |
SELECT AVG(population_years.population) AS 'Poland Average Population' | |
FROM countries | |
JOIN population_years | |
ON countries.id = population_years.country_id | |
WHERE countries.name = 'Poland'; | |
SELECT COUNT(*) AS 'Countries containing The' | |
FROM countries | |
WHERE name LIKE '%The%'; | |
SELECT countries.continent, SUM(population_years.population) AS 'Pupulation in 2010 (in millions)' | |
FROM countries | |
JOIN population_years | |
ON countries.id = population_years.country_id | |
WHERE year = 2010 | |
GROUP BY countries.continent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment