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
WITH film_rentals AS ( SELECT f.film_id, f.title AS film_title, COUNT(r.rental_id) AS rental_count, DENSE_RANK() OVER (ORDER BY COUNT(r.rental_id) DESC) AS film_rank FROM film f JOIN inventory i ON f.film_id = i.film_id JOIN rental r ON i.inventory_id = r.inventory_id WHERE YEAR(r.rental_date) = 2005 GROUP BY f.film_id, f.title ) SELECT film_rank, film_title FROM film_rentals 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