Single solution for both Oracle and MYSQL
Intuition\nMYSQL/Oracle ---One single solution for both!\nWell, I just found out that its easy with the simple case statement solution to check for the Inner no
# Intuition\nMYSQL/Oracle ---One single solution for both!\nWell, I just found out that its easy with the simple case statement solution to check for the Inner node of the tree as follows!\n\n# Approach\nSee if the parent node is null and mark it as root then,\nsee if the id is one of the parent id and if so.. it will be a inner node as we are first checking for the root node and then again moving on to check for the parent node// tricky, but makes sense!\nelse the id is a leaf node.\n\n# Complexity\n- Time complexity:\n1118ms or 1139ms\n\n- Space complexity:\n0B\n\n# Code\n```\n# Write your MySQL query statement below\n/* Write your PL/SQL query statement below */\nselect 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\n from tree\n```
['MySQL']