Problem in SQL practice project - task description

https://www.codecademy.com/practice/projects/world-populations-sql-practice-ii

In world Population SQL practice II, Question 4 says

  1. “What was the total population of the continent of Oceania in 2005?”

(emphasis mine)

In the downloadale .sql file for doing this exercise on one’s own pc, the same question goes like this:

-- What was the total population of Oceania in 2005?

so the “continent” part is missing.
The total number of continents in my head is seven, not including something called Oceania, which Wikipedia seems to agree with - Oceania is listed there as being grouped together with Australia into a geographical region or “quasi-continent”.
Anyways, I read the question in the downloaded sql file, and I just thought Oceania must be one of the many countries I haven’t heard of yet - and wrote my SQL query accordingly:

WITH countrypop as (
SELECT * FROM population_years py
JOIN countries c
ON c.id = py.country_id
)
select population from countrypop
where name = 'Oceania'; --name is the column where country names are listed
--  I should have looked for Oceania in the continents column

This led to some frustration as that query comes up empty and it took me a few steps to find out that Oceania is in the continents column and I needed to query that one (the “total” in the question still might have tipped me off to the fact that there were many parts to Oceania that I needed to sum up, but it didn’t).
I’m guessing the addition of “the continent of” in the web version was made for a similar reason, but forgotten in the downloadable files, and suggest this be corrected.
Or alternatively ask about a different continent (in both verisons) where nobody’s going to argue about whether it is one.

No. Oceania may or may not be a continent in real life, but in this exercise, Oceania counts as a continent, so a table may look like this(just for example):

Continent|ID| Name| (etc.)
Oceania|3|Australia

This means your query has to contain the query for continent, not the name of a country.
I hope this helps!
Happy coding!

1 Like