Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 21, 2020 00:31
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/abd18e7beb221dc25ee84fe1ba5a7073 to your computer and use it in GitHub Desktop.
Save codecademydev/abd18e7beb221dc25ee84fe1ba5a7073 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:
--largest population size for Gabon
SELECT *
FROM population_years
where country ='Gabon'
order by population
;
--10 lowest population countries in 2005
SELECT country, population
from population_years
where year =2005
order by population ASC
limit 10;
--distinct countries with a population of over 100 million in 2010
select distinct country
from population_years
where population > 100
and year = '2010';
--count of countries that have the world "Islands"
SELECT count(*)
from population_years
where country LIKE '%Islands%';
--Differece in population in Indonesia between 2000 and 2010
SELECT population, year
from population_years
where country = 'Indonesia' and year = 2000
OR country = 'Indonesia' and year = 2010;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment