World Populations Challenge Project (SQL)



  1. What years are covered by the dataset?

(provided) SELECT DISTINCT year from population_years;

Answer: 11

  1. — What is the largest population size for Gabon in this dataset?

SELECT population
FROM population_years
WHERE country = “Gabon”
ORDER by population DESC
LIMIT 1;

Answer: 1.54526

  1. What were the 10 lowest population countries in 2005?

SELECT DISTINCT country
FROM population_years
WHERE year = 2005
ORDER BY population
LIMIT 10;

Answer:

Niue
Falkland Islands (Islas Malvinas)
Montserrat
Saint Pierre and Miquelon
Saint Helena
Nauru
Cook Islands
Turks and Caicos Islands
Virgin Islands, British
Gibraltar

  1. 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
ORDER BY population DESC;

Answer:

China
India
United States
Indonesia
Brazil
Pakistan
Russia
Bangladesh
Japan
Nigeria
Mexico

  1. How many countries in this dataset have the word “Islands” in their name?

SELECT COUNT ( DISTINCT country)
FROM population_years
WHERE country like “%islands%”;

Answer: 9

  1. What is the difference in population between 2000 and 2010 in Indonesia?

SELECT *
FROM population_years
WHERE country = “Indonesia” AND year like “%0”
ORDER by population DESC;

Answer: 242.96834 (2010) - 214.67661 (2000) = 28.29173

My solution

My solution. Any feedback on improving welcome!