too easy query (should not be in medium)
\nselect id,\ncase when p_id is null then \'Root\'\nwhen id in (select distinct(p_id) from Tree) then \'Inner\'\nelse \'Leaf\'\nend\nas type\nfrom Tree
```\nselect id,\ncase when p_id is null then \'Root\'\nwhen id in (select distinct(p_id) from Tree) then \'Inner\'\nelse \'Leaf\'\nend\nas type\nfrom Tree```
['MySQL']