Leetcode - 601. Human Traffic of Stadium
문제
정답
CREATE VIEW
가 안돼서 찾아보니 다행히 WITH AS
로 뷰를 만들 수 있었다.
WITH temp AS (
select *, id - ROW_NUMBER() OVER(ORDER BY id) AS gap
FROM Stadium
WHERE people >= 100
)
SELECT id, visit_date, people
FROM temp
WHERE gap IN (SELECT gap FROM temp GROUP BY gap HAVING COUNT(*) >= 3)