Will someone help me with this question. I know my solution is wrong. I just don’t know how to do it. I’m sure it will be simple to everyone else. Thank you.


Will someone help me with this question. I know my solution is wrong. I just don’t know how to do it. I’m sure it will be simple to everyone else. Thank you.
What is your output when you run this query?
It returns no result.
Your solution looks fine, though I have a sneaking suspicion that your problem comes from your WITH table’s name. I don’t think they can start with numbers. (I’m referring to 2020_review
)
Also, there are inner joins in SQL, but to actually do one, you don’t write INNER JOIN
. It’s just JOIN
. Try making these 2 changes and tell me if it solves your problem.
Still nothing.
Why did you name your temporary table the same as reviews
? Other than that it should work.
I originally named it 2020_reviews, because it was in the lesson. You suggested a WITH
might not can start with numbers, so I removed 2020 and INNER
. It still returns no results.
Just change the name to something that doesn’t start with a number (ex. reviews_2020
). In fact, the error was coming from your temporary table name all along. You were still getting an error because you already had a table named ‘reviews’, but still named your temporary table that.
I was mistaken, you can write INNER JOIN
with no problem.
Your original query (with the changed name):
with reviews_2020 as (
select *
from reviews
where strftime('%Y',review_date)='2020'
)
select *
from reviews_2020
inner join places
on reviews_2020.place_id=places.id;
works fine.
WOW! That worked. You taught me something today. I’ll always remember that. Thank you so much.