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 film_rank, film_title FROM ( SELECT DENSE_RANK() OVER (ORDER BY COUNT(r.rental_id) DESC) AS film_rank, f.title AS film_title, COUNT(r.rental_id) AS rentals_count FROM film f JOIN inventory i ON f.film_id = i.film_id JOIN rental r ON i.inventory_id = r.inventory_id WHERE r.rental_date >= '2005-01-01' AND r.rental_date < '2006-01-01' GROUP BY f.film_id, f.title ) ranked WHERE film_rank <= 3 ORDER BY film_rank, film_title; ; show status like 'Last_query_cost';

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

Copy Clear