[HR] Binary Tree Nodes

yozzum·2022년 9월 18일
0

SQL

목록 보기
6/25
  • Advanced Select > Scalar subquery > case when
  • input

  • output

select t.n
      ,case when t.p is null then "Root"
            when t.n in (select t1.p from bst t1 where t1.p is not null) then "Inner"
            else "Leaf" end as "result"
from bst t
order by t.n
profile
yozzum

0개의 댓글