leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0608.sql (264B)


      1 SELECT id, (
      2     CASE
      3         WHEN T.p_id IS NULL THEN 'Root'
      4         WHEN P.p_id IS NOT NULL THEN 'Inner'
      5         ELSE 'Leaf'
      6     END
      7     ) AS type
      8 FROM TREE T
      9 LEFT JOIN (
     10     SELECT p_id, COUNT(*) AS count
     11     FROM Tree
     12     GROUP BY p_id
     13 ) AS P
     14 ON T.id = P.p_id