SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
/*select avg(days_between_rentals) avg_days_between_rentals from ( select film_id ,rental_date ,return_date ,ld ,(datediff(ld, return_date)) days_between_rentals from (*/ select inventory_id ,rental_date ,return_date ,lead(rental_date) over(partition by inventory_id order by rental_date) ld ,timestampdiff(MINUTE, return_date, lead(rental_date) over(partition by inventory_id order by rental_date))/1440 days_between_rentals from rental order by inventory_id, rental_date /*) t ) t2

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear