
# parent_id 몇개 있는지 count해서 child_count로?
with count_child as (
select parent_id , count(parent_id) as child_count
from ecoli_data
where parent_id is not null
group by parent_id)
select e.id, ifnull(c.child_count,0) as child_count
from ecoli_data e
left outer join count_child c on e.id = c.parent_id
order by e.id