✅||MySQL || Tree Node || Easy Solution || ✅
SELECT id,\n       CASE WHEN p_id IS NULL THEN \'Root\'\n            WHEN id IN (SELECT p_id FROM tree) THEN \'Inner\'\n            ELSE \'Leaf\'\n            E
SELECT id,\n       CASE WHEN p_id IS NULL THEN \'Root\'\n            WHEN id IN (SELECT p_id FROM tree) THEN \'Inner\'\n            ELSE \'Leaf\'\n            END AS type\nFROM tree\nORDER BY id ASC;\n\nPlease Upvote this solution, if you find it useful...
['MySQL']