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

SQLize | PHPize | SQLtest

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

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
SELECT title AS most_rented_movie FROM film WHERE film_id = ( SELECT inventory.film_id FROM rental JOIN inventory USING (inventory_id) WHERE rental_date BETWEEN '2006-02-01' AND '2006-02-28' GROUP BY film_id ORDER BY COUNT(*) DESC LIMIT 1 ); /* SELECT title, count(*) FROM film f JOIN inventory i USING (film_id) WHERE EXISTS ( SELECT 1 FROM rental r WHERE r.inventory_id = i.inventory_id AND YEAR(r.rental_date) = 2006 AND MONTH(r.rental_date) = 2 ) GROUP BY f.film_id; /* SELECT f.title, count(f.film_id) cnt FROM film f JOIN inventory i USING (film_id) WHERE EXISTS ( SELECT 1 FROM rental r WHERE r.inventory_id = i.inventory_id AND YEAR (r.rental_date) = 2006 AND MONTH (r.rental_date) = 2 ) GROUP BY f.film_id ORDER BY cnt DESC; */ ; show status like 'Last_query_cost';

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

Copy Clear