# Write your MySQL query statement below
select id, (
case
when p_id is null then 'Root'
when id in (select p_id from tree) then 'Inner'
else 'Leaf'
end
) as Type from tree
leetcode+608. Tree Node+SQL+判断二叉树节点类型
最新推荐文章于 2024-09-05 09:00:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)