Having Trouble With Question 8 From the SQL Welp example. https://www.codecademy.com/paths/analyze-data-with-sql/tracks/analyze-data-sql-join-data/modules/analyze-data-sql-practice-joins/projects/sql-welp

Trying to solve this question:

Sometimes on Welp, there are some old reviews that aren’t useful anymore.

Write a query using the WITH clause to select all the reviews that happened in 2020. JOIN the places to your WITH query to see a log of all reviews from 2020.

(This will use the WITH clause as well as the strftime() function. See if you can use Google to dig up some information about the function before take a look at the hint.)

I can’t figure out how to “JOINtheplacesto yourWITH` query”. Below is what I tried but it doesnt seem to work:

WITH 2020review AS (SELECT * FROM reviews WHERE strftime("%Y",review_date) = '2020')
FROM places JOIN 2020review ON (places.id = 2020reviews.place_id);

Any assistance would be great.



I think your issue relates to using a reference starting with a number. There are way to get around this if you look around but simply swapping it to say reviews2020 should be enough.


Thanks! That was the issue, works fine when I change the name to reviews2020.

1 Like