-- 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;