Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node:
풀이
제출한 답
select N, (case
when p is null then 'Root'
when N in (select p from bst) then 'Inner'
else 'Leaf' end)
from bst
order by N
-> P에 있는 값이 N에도 있으면 Inner
'데이터 분석 > SQL 연습문제' 카테고리의 다른 글
Ollivander's Inventory (HackerRank) (0) | 2022.11.05 |
---|---|
SQL Project Planning (HackerRank) (0) | 2022.11.04 |
Weather Observation Station 5 (HackerRank) (0) | 2022.10.12 |
Occupations (HackerRank) (0) | 2022.10.11 |
New Companies (HackerRank) (0) | 2022.10.05 |
댓글