leetcode/solution/0600-0699/0608.Tree Node
..
README.md
README_EN.md
Solution.sql

README_EN.md

608. Tree Node

中文文档

Description

None

Solutions

SQL

SELECT id AS Id,
        
    CASE
    WHEN p_id is NULL THEN
    'Root'
    WHEN id IN 
    (SELECT p_id
    FROM tree
    WHERE p_id is NOT null) THEN
    'Inner'
    ELSE 'Leaf'
    END AS Type
FROM tree