Easy SQL Challenge: Using WINDOWS Function

365 Days of Daily Challenge: Day 77

I am very happy with a progress that I made for one of my internal projects. I have been wanting to make good progress for a very long time and I was finally able to do so this time around. I hope it yearns good result. Super duper excited about it.

On a side note, I have decided to embark on another personal project. This time I will specifically work on building visualisation using Tableau. Pumped for that entirely.

Today, I solved an easy challenge.

SELECT customer_id, date
FROM (
SELECT customer_id, DATE(rental_ts) AS date, ROW_NUMBER()
OVER (PARTITION BY customer_id ORDER BY DATE(rental_ts)) AS ranks
FROM rental) AS k
WHERE customer_id IN (1,2,3,4,5,6,7,8,9,10)
AND ranks = 10;

Leave a comment