with counted (title, copies) as (select distinct title, count(*) over (partition by title) as copies
from film f
join inventory i
on f.film_id=i.film_id
join rental r
on i.inventory_id=r.inventory_id
where year(rental_date)=2005
order by copies desc)
select film_rank, title as film_rank
from (select title, dense_rank() over (order by copies desc) as film_rank from counted) ranking
where film_rank <=3
; SHOW STATUS LIKE 'Last_query_cost';