Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit af89459

Browse files
committed
이예진: [SQL] Tree Node_241217
1 parent f0ef9f1 commit af89459

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎SQL/15주차/Tree Node.sql‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SELECT
2+
t1.id,
3+
CASE
4+
WHEN t1.p_id IS NULL THEN 'Root'
5+
WHEN t2.id IS NULL THEN 'Leaf'
6+
ELSE 'Inner'
7+
END AS type
8+
FROM Tree t1
9+
LEFT JOIN Tree t2
10+
ON t1.id = t2.p_id
11+
GROUP BY t1.id;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /