Binary Tree Nodes

  • + 0 comments

    SELECT N, IF(P IS NULL, 'Root', if( N IN (SELECT DISTINCT P FROM BST), 'Inner', 'Leaf' ) ) as bts FROM BST ORDER BY N;