You are viewing a single comment's thread. Return to all comments →
Here's also my solution using CASE clause
SELECT BT.N, CASE WHEN BT.P IS NULL THEN 'Root' WHEN EXISTS (SELECT B.P FROM BST B WHERE B.P = BT.N) THEN 'Inner' ELSE 'Leaf' END FROM BST AS BT ORDER BY BT.N
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Tree Nodes
You are viewing a single comment's thread. Return to all comments →
Here's also my solution using CASE clause