Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 511 Bytes

File metadata and controls

34 lines (24 loc) · 511 Bytes

English Version

题目描述

None

解法

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