All right, so I’ve been working on this particular exercise:https://www.codecademy.com/practice/projects/world-populations-sql-practice-ii
This is question # 4:
What was the total population of the continent of Oceania in 2005?
This is what Codecademy says is right:
SELECT SUM(population) FROM population_years
INNER JOIN countries ON
countries.id = population_years.country_id
WHERE year = 2005
AND continent = ‘Oceania’;
This is what I wrote:
WITH full_data AS (
SELECT * FROM countries
ON countries.id = population_years.country_id)
SELECT SUM(population_years.population), countries.continent, population_years.year
WHERE countries.continent = ‘Oceania’ AND population_years.year = 2005;
I know it is incorrect since DB Browser lets me know there is a mistake. It says “Result: no such column: population_years.population”
Can somebody explain to me what I am doing wrong? Thanks.
I understand the workflow of the correct answer provided by Codecademy, I’d just like to know why my approach does not work.