SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
SELECT c.customer_id, c.first_name, c.last_name, CEIL(AVG(TIMESTAMPDIFF(HOUR, r.rental_date, r.return_date))) AS average_rental_time FROM customer c JOIN rental r ON c.customer_id = r.customer_id WHERE r.return_date IS NOT NULL GROUP BY c.customer_id, c.first_name, c.last_name ORDER BY c.customer_id;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear