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 horror_films as ( select f.film_id, title from film f join film_category fc on f.film_id=fc.film_id join category c on fc.category_id=c.category_id where name = 'Horror' and rating = 'PG-13'), rental_rank as (select title, FIRST_VALUE(first_name) over (partition by hf.film_id order by rental_date) as first_name, FIRST_VALUE(last_name) over (partition by hf.film_id order by rental_date) as last_name, ROW_NUMBER() OVER (PARTITION BY hf.film_id ORDER BY r.rental_date) AS rn from horror_films hf join inventory i on hf.film_id=i.film_id join rental r on i.inventory_id=r.inventory_id join customer c on r.customer_id=c.customer_id) select distinct title, CONCAT(first_name, ' ', last_name) as first_customer from rental_rank where rn=1 order by title ; show status like 'Last_query_cost';

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

Copy Clear