mirror of https://github.com/doocs/leetcode.git
|
…
|
||
|---|---|---|
| .. | ||
| 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