/* select title, first_customer
From
(
Select
concat(c.first_name, ' ', c.last_name) first_customer
, f.title
, row_number() over (partition by f.title order by r.rental_date) rk
from rental r
join inventory i
on r.inventory_id = i.inventory_id
join customer c
on c.customer_id = r.customer_id
join film f
on f.film_id = i.film_id
join film_category fc
on fc.film_id = f.film_id
join category ct
on ct.category_id = fc.category_id
where f.rating = 'PG-13'
and ct.name = 'Horror'
)t
Where rk = 1
*/
Select
concat(c.first_name, ' ', c.last_name) first_customer
, f.title
-- , row_number() over (partition by f.title order by r.rental_date) rk
, first_value(r.rental_date) (partition by f.title order by concat(c.first_name, ' ', c.last_name))
from rental r
join inventory i
on r.inventory_id = i.inventory_id
join customer c
on c.customer_id = r.customer_id
join film f
on f.film_id = i.film_id
join film_category fc
on fc.film_id = f.film_id
join category ct
on ct.category_id = fc.category_id
where f.rating = 'PG-13'
and ct.name = 'Horror'