Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 420 Bytes

README_EN.md

File metadata and controls

31 lines (22 loc) · 420 Bytes

中文文档

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