Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 503 Bytes

File metadata and controls

35 lines (24 loc) · 503 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