-
-
Save codecademydev/97a1739fdd9a5679e59ffa6be9936cb4 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
-- This is the first query: | |
SELECT DISTINCT year from population_years; | |
-- Add your additional queries below: | |
-- Returns the largest population in Gabon in the dataset | |
SELECT MAX(population) | |
FROM population_years | |
WHERE country = 'Gabon'; | |
-- Returns the 10 lowest population countries and their population in 2005 and sorts in ascending order | |
SELECT country, population | |
FROM population_years | |
WHERE year = 2005 | |
ORDER BY population ASC | |
LIMIT 10; | |
-- Returns all countries and their population where population is over 100m in 2010 and sorts in asecending order | |
SELECT DISTINCT country, population | |
FROM population_years | |
WHERE year = 2010 | |
AND population > 100 | |
ORDER BY population ASC; | |
-- Counts how many countries in the dataset have "Islands" anywhere in the name | |
SELECT COUNT(DISTINCT(country)) | |
FROM population_years | |
WHERE country LIKE "%Islands%"; | |
-- Returns population of Indonesia in 2000 and 2010 | |
SELECT * | |
FROM population_years | |
WHERE (year = 2000 OR year = 2010) | |
AND country = "Indonesia"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment