Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created February 16, 2020 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/8f24de064396d08b768bb32eb8a354fd to your computer and use it in GitHub Desktop.
Save codecademydev/8f24de064396d08b768bb32eb8a354fd to your computer and use it in GitHub Desktop.
Codecademy export
-- 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