Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 430 Bytes

README_EN.md

File metadata and controls

32 lines (22 loc) · 430 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