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
Share      Blog   Popular

SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code. You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.

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 inventory_id in (6,9) ) SELECT inventory_id,return_date,next_rental_date,(datediff(next_rental_date,return_date)) FROM rental_dates /* 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 ChatGPT!

Copy Clear