프로젝트(진행중)/MySQL
Recursive Table
일말고프로젝트
2023. 3. 10. 22:54
재귀테이블이란 한 테이블 안에 칼럼이 다른 칼럼을 참조하는 형식을 갖춘 테이블을 말한다. 대부분의 재귀테이블은 계층구조와 밀접한 연관이 있다.
https://mariadb.com/kb/en/recursive-common-table-expressions-overview/
Recursive Common Table Expressions Overview
A recursive CTE will repeatedly execute subsets of the data until obtaining the complete results.
mariadb.com
두 파트로 나뉨
1. Anchor Part : n =1일 때
2. Recursive Part : n +1일
주의할 점
1. Recursive part에 join으로 anchor와 결합되어야함
2. where 조건에 재귀적 표현 쓸 수 없음