✅ 🔥 MYSQL || ⚡very easy solution uwu
\n\nSELECT id, \n    CASE \n        WHEN p_id IS NULL THEN \'Root\' \n        WHEN p_id IS NOT NULL AND id IN (SELECT p_id FROM Tree) THEN \'Inner\' \n        E
\n```\nSELECT id, \n    CASE \n        WHEN p_id IS NULL THEN \'Root\' \n        WHEN p_id IS NOT NULL AND id IN (SELECT p_id FROM Tree) THEN \'Inner\' \n        ELSE \'Leaf\' \n    END AS type\nFROM Tree\nORDER BY id;\n```
['MySQL', 'Oracle', 'MS SQL Server']