Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 23, 2020 16:06
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/edac81633198d5ce9f83a520b7ade844 to your computer and use it in GitHub Desktop.
Save codecademydev/edac81633198d5ce9f83a520b7ade844 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:
Select country, population from population_years
WHERE country = 'Gabon'
ORDER BY population desc
LIMIT 1;
--Gabon's largest population size in the dataset is 1.54526
SELECT country FROM population_years
WHERE year = 2005
ORDER BY population ASC
LIMIT 10;
--Niue, Falkland Islands (Islas Malvinas), Montserrat, Saint Pierre and Miquelon, Saint Helena, Nauru, Cook Islands, Turks and Caicos Islands, Virgin Islands, British, Gibraltar
SELECT Distinct country from population_years
where year = 2010
AND population > 100;
--Mexico, United States, Brazil, Russia, Nigeria, Bangladesh, China, India, Indonesia, Japan, Pakistan
SELECT count(DISTINCT country) from population_years
WHERE country LIKE '%Islands%';
--9 countries with Islands in name
SELECT * from population_years
where year = 2000
and country = 'Indonesia';
SELECT * from population_years
where year = 2010
and country = 'Indonesia';
--Answer = 28.29173m population difference between 2000 and 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment