QuXiangjie / Study-Review

自己欠缺的还太多了,希望通过总结每天的学习内容,整理每天的思绪来丰富自己的知识库。我想成为一名优秀的金融数据分析师,并行发展技术与商业业务。博客内容为:数理统计、财务业务、Python(数据分析及可视化)、Excel(数据分析)、SQL、英文
0 stars 0 forks source link

608. Tree Node #22

Open QuXiangjie opened 6 months ago

QuXiangjie commented 6 months ago

608.Tree Node

# Write your MySQL query statement below
select id, case 
when p_id is null then 'Root'
when p_id in (select id from tree) and id in (select p_id from tree) then 'Inner'
ELSE 'Leaf'
end as type
from Tree
QuXiangjie commented 6 months ago

case when (condition) then "label name" when (condition) then "label name" ELSE end as "col name" from where