Posted by Navneet, Feb. 24, 2024, 11:56 a.m.
Correct solution to the question: Write a query to return the number of customers who rented at least one movie in both May 2020 and June 2020.
Can anyone please help me with this query, I'm not able to get to the correct answer and am not able to figure out the missing part here either.
This is the query I ran for the above question:
select count(distinct customer_id)
from rental
where extract(year from rental_ts) = 2020 and (extract(month from rental_ts)=5 or
extract(month from rental_ts)=6)
It's giving the solution as 598, however, the expected result shown is '507'
I tried putting the filter condition with every possible column, say 'where rental_id is not null' , 'where inventory_id is not null'. All of them give the same result '598'.