Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize Online / PHPize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear
with rental_dates as ( select inventory_id, return_date, lead(rental_date) over (partition by inventory_id order by rental_date) next_rental_date from rental where return_date is not null ) select avg(datediff(next_rental_date, return_date)) avg_days_between_rentals from rental_dates where next_rental_date is not null

Stuck with a problem? Got Error? Ask AI support!

Copy Clear