Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c1c55e

Browse files
committed
Time: 487 ms (38.12%) | Memory: 0B (100.00%) - LeetSync
1 parent 1480579 commit 4c1c55e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

608-tree-node/tree-node.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Write your MySQL query statement below
2+
SELECT id,
3+
CASE
4+
WHEN p_id IS NULL THEN 'Root'
5+
WHEN id IN (SELECT p_id FROM tree) THEN 'Inner'
6+
ELSE 'Leaf'
7+
END AS type
8+
FROM tree
9+
ORDER by id ASC;

0 commit comments

Comments
 (0)