-
-
Save codecademydev/298e976c2aa1554ce1d3d8c1a4795873 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; | |
-- Answer is 2000 - 2010 | |
-- Add your additional queries below: | |
-- Largest population size for Gabon : | |
SELECT * | |
FROM population_years | |
WHERE country = 'Gabon' | |
ORDER BY population DESC; | |
-- Answer is 1.54526 million | |
-- 10 lowest population countries in 2005 : | |
SELECT * | |
FROM population_years | |
WHERE year = 2005 | |
ORDER BY population ASC | |
LIMIT 10; | |
-- Answer is Niue; Falkland Islands (Islas Malvinas); Montserrat; Saint Pierre and Miquelon; Saint Helena; Nauru; Cook Islands; Turks and Caicos Islands; Virgin Islands, British; Gibraltar | |
-- Distint ocuntries with population over 10 million in 2010 : | |
SELECT DISTINCT * | |
FROM population_years | |
WHERE population > 100 | |
AND year = 2010; | |
-- Answer is Mexico; United States; Brazil; Russia; Nigeria; Bangladesh; China; India; Indonesia; Japan; Pakistan | |
-- Countries with 'Islands' in their name : | |
SELECT DISTINCT * | |
FROM population_years | |
WHERE country LIKE '%Islands%'; | |
-- Answer is 9: Cayman Islands; Falkland Islands (Islas Malvinas); Turks and Caicos Islands; Virgin Islands, US; Virgin Islands, British; Faroe Islands; Cook Islands; Solomon Islands; U.S. Pacific Islands; | |
-- Difference in population between 2010 & 2000 in Indonesia | |
SELECT * | |
FROM population_years | |
WHERE country = 'Indonesia' | |
AND year = 2000 | |
AND year = 2010; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment