select * from self_join;

SELECT A.category_type,
A.category_name,
B.category_type,
B.category_name
FROM self_join A,
self_join B
WHERE A.category_name = B.parent_category
AND A.category_type = '대';

SELECT A.category_type,
A.category_name,
B.category_type,
B.category_name,
C.category_type,
C.category_name
FROM self_join A,
self_join B,
self_join C
WHERE A.category_name = B.parent_category
AND B.category_name = C.parent_category;

카테고리의 Depth가 깊어질수록 셀프 조인이 반복되는데, 계층 쿼리를 이용하면 좀 더 간단하게 쿼리를 작성할수 있다.