문제
Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

정답
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