-
-
Save codecademydev/673fc21ab4b9aac4b559cb35b3eaf0d9 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: | |
--The schema of the database is: | |
-- Column Type Notes | |
-- country STRING | |
-- population NUMBER (in millions) | |
-- year NUMBER | |
-- Refer to this schema as you write queries to the database. | |
SELECT DISTINCT year from population_years; | |
-- Add your additional queries belo | |
--What is the largest population size for Gabon in this dataset? | |
select * from population_years where country='Gabon' order by population desc limit 1; | |
--select * from population_years where country='Gabon' ; | |
--What were the 10 lowest population countries in 2005? | |
select country,population from population_years where year =2005 order by population limit 10; | |
--What are all the distinct countries with a population of over 100 million in the year 2010? | |
select distinct country from population_years where population > 100 and year = 2010; | |
--How many countries in this dataset have the word “Islands” in their name? | |
select country from population_years where country like '%Islands%'; | |
--What is the difference in population between 2000 and 2010 in Indonesia? | |
-- Note: it’s okay to figure out the difference by hand after pulling the correct data. | |
select country,year,population from population_years where year =2000 and country = 'Indonesia'; | |
select country,year,population from population_years where year =2010 and country = 'Indonesia'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment