Leetcode - 603. Consecutive Available Seats
문제
정답
SELECT seat_id
FROM
(SELECT
CASE
WHEN LEAD(free,1) OVER (ORDER BY seat_id) = 1 AND free = 1 THEN seat_id
WHEN LAG(free,1) OVER (ORDER BY seat_id) = 1 AND free = 1 THEN seat_id
END AS seat_id
FROM Cinema) AS Temp
WHERE seat_id IS NOT NULL