Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1480579 commit 4c1c55eCopy full SHA for 4c1c55e
608-tree-node/tree-node.sql
@@ -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