with custs as(
select customer_id,count(rental_id) as rent_ct from rental
group by customer_id
having count(rental_id) > (select count(rental_id)/count(distinct customer_id) from rental)
)
select t1.customer_id, t2.first_name,t2.last_name,
t1.rent_ct
from custs t1 join customer t2
on t1.customer_id = t2.customer_id;
;
show status like 'Last_query_cost';