๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Database

SQL Oracle * LAG/LEAD: ์ด์ „/์ดํ›„ ๋กœ์šฐ ๊ฐ’ ๋ฐ˜ํ™˜

LAG

๋ช…์‹œ๋œ ๊ฐ’์„ ๊ธฐ์ค€์œผ๋กœ ์ด์ „ ๋กœ์šฐ์˜ ๊ฐ’ ๋ฐ˜ํ™˜

LAG(๋Œ€์ƒ, ๋ช‡๋ฒˆ์งธ ์ „ ๋กœ์šฐ, null์ธ ๊ฒฝ์šฐ ๋ฐ˜ํ™˜ ๋  ๊ฒƒ)  OVER ( ORDER BY ๋Œ€์ƒ )

 

 

LEAD

๋ช…์‹œ๋œ ๊ฐ’์„ ๊ธฐ์ค€์œผ๋กœ ์ดํ›„ ๋กœ์šฐ์˜ ๊ฐ’ ๋ฐ˜ํ™˜

LAG(๋Œ€์ƒ, ๋ช‡๋ฒˆ์งธ ํ›„ ๋กœ์šฐ, null์ธ ๊ฒฝ์šฐ ๋ฐ˜ํ™˜ ๋  ๊ฒƒ)  OVER ( ORDER BY ๋Œ€์ƒ )