Having trouble with Welp Project

https://www.codecademy.com/paths/analyze-data-with-sql/tracks/analyze-data-sql-join-data/modules/analyze-data-sql-practice-joins/projects/sql-welp
Hello, am having a hard time with the following 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.

Although i think i’ve managed to right down the query the right way i can’t find which ON statement to use.

Here’s my query :

What would be the key shared between these two tables? I’d imagine you’ve already used it in previous steps.

1 Like

Can’t find any key shared between them :frowning: . Since WITH creates a new temporary table . It’s a bonus question so i haven’t used is before. places table doesn’t have any column that says something about review date or something .

You use * in your select statement so your table would be almost (with the exception of the rows filtered out by WHERE …) identical to the original reviews table. Perhaps it would be worthwhile just querying this table (perhaps with LIMIT) so you know exactly what you did when creating the temporary table.

I think * is necessary because we want the other information aswell. T

Tried something like this doesn’t seem to work either. :frowning:

One tip to work with this is to make sure your query returns the results you expect before you try to use it in a WITH

will not return any results, so there is nothing to join. Focus on getting results with the subquery first, then you should be good to go

3 Likes

Be careful with your comparisons in this is instance, double check what strftime actually returns.

3 Likes

Thanks for the feed back ! It seems ’ ’ were missing from 2020 . On to the next one ! :smiley:

But why that sentence don’t even return nothing.
I have try to use the missing quotes in the 2020 and others comparisons whit strftime but I even still get nothing.
Can you explain a little bit more please.

The previous issue boils down to the fact that '2020' is not equal to 2020 due to the comparison between different data types. What have you tried?

You can trial the output of strftime if you wanted to test things, see for example the following (you could even throw in a WHERE clause to check the other side of the comparison should you wish to)-

select strftime("%Y", review_date)
from reviews;
1 Like

Interesting. As I went through the reviews one by one, I see a couple in the year 2020. Not sure why it would not return anything for 2020.