-
-
Save codecademydev/8f24de064396d08b768bb32eb8a354fd 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: | |
--4. Largest population size for Gabon = 1.54526 | |
SELECT country, MAX(population) | |
FROM population_years | |
WHERE country = 'Gabon'; | |
--5. 10 lowest population countries in 2005: | |
SELECT * | |
FROM population_years | |
WHERE year = 2005 | |
ORDER BY population ASC | |
LIMIT 10; | |
--6. Distinct countries with a population of over 100 million in the year 2010: | |
SELECT * | |
FROM population_years | |
WHERE year = 2010 AND population > 100.000000 | |
ORDER BY population; | |
--7. 9 distinct countries have the word "Island" in their name: | |
SELECT COUNT(DISTINCT(country)) | |
FROM population_years | |
WHERE country LIKE '%Island%'; | |
--8. The difference in population between 2000 and 2010 in Indonesia is= 28,292,730 | |
SELECT * | |
FROM population_years | |
WHERE country = 'Indonesia' | |
GROUP BY year; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment