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 -- FROM film -- WHERE film_id IN ( -- SELECT film_id -- FROM film_actor -- WHERE actor_id = 5 -- ); -- SELECT title, -- ROW_NUMBER() OVER (ORDER BY length DESC) AS row_num -- FROM film; -- select title, rating, length, -- row number() over (partition by rating order by length desc) as rn -- from film; -- with cte as ( -- SELECT -- title, -- rating, -- length, -- ROW_NUMBER() OVER (PARTITION BY rating ORDER BY length) AS rn -- FROM film) -- select * from cte where rn <=3; -- -lead and lag -- select title, rating, length, -- lead (length,2) over (order by title) as length_next_movie -- from film; select title, rating, length, lag (length,1) over (order by title) as length_next_movie from film;

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

Copy Clear