-
-
Save codecademydev/50738a2969960c9f493f1db59faaf9a0 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: | |
-- Selects largest population size for Gabon in dataset | |
select * | |
from population_years | |
where country = 'Gabon' | |
order by population desc | |
limit 1; | |
-- Selects 10 lowest population countries in 2005 | |
select * | |
from population_years | |
where year = 2005 | |
order by population asc | |
limit 10; | |
-- Selects all distinct countries with a population over 100 million in 2010 | |
select distinct country | |
from population_years | |
where population > 100 and year = 2010; | |
-- Counts all countries that have the word "Islands" in their name | |
select count (distinct country) | |
from population_years | |
where country like '%Islands%'; | |
-- Selects population in Indonesia between 2000 and 2010 | |
select * | |
from population_years | |
where country = 'Indonesia' | |
and year in (2000, 2010); | |
-- 242.96834 - 214.67661 = 28.29173 million | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment