🟩 MySQL | Easy Solution | Using Case
\nselect id, \ncase\nwhen p_id is null then \'Root\'\nwhen id in (select distinct p_id from Tree) then \'Inner\'\nelse \'Leaf\'\nend\nas type \nfrom Tree\norder
```\nselect id, \ncase\nwhen p_id is null then \'Root\'\nwhen id in (select distinct p_id from Tree) then \'Inner\'\nelse \'Leaf\'\nend\nas type \nfrom Tree\norder by id;\n```
['MySQL']