android sqlite递归,递归SQLite查询

本文探讨了一种递归查询方法,用于从'immunodeficiencies'开始,逐步深入到如Bruton agammaglobulinemia和DiGeorge综合征等具体的免疫缺陷疾病。通过查询数据表'dx_graph',展示如何利用关系图谱来查找包含关系,揭示了疾病分类和关联的层次结构。
摘要由CSDN通过智能技术生成

开始

相对

免疫缺陷

包括

B细胞缺陷

包括

免疫缺陷

包括

T细胞缺乏症

包括

DiGeorge综合征

有更多的价值,但这是要点。

我正在尝试进行一个递归查询,以获取

immunodeficiencies

. 例如,我想

Bruton agammaglobulinemia, DiGeorge syndrome

with recursive tc( i )

as ( select endn from dx_graph where startn = 'immunodeficiencies' and rel = 'includes'

union endn from dx_graph, tc where startn = tc.i and rel = 'includes'

)

select * from tc;

样本数据:

CREATE TABLE "dx_graph" (

"startn" TEXT,

"rel" TEXT,

"endn" TEXT,

)

insert into dx_graph values ('immunodeficiencies', 'includes', 'B-cell deficiencies')

insert into dx_graph values ('immunodeficiencies', 'includes', 'T-cell deficiencies')

insert into dx_graph values ('immunodeficiencies', 'includes', 'complement disorders')

insert into dx_graph values ('B-cell deficiencies', 'includes', 'Bruton agammaglobulinemia')

insert into dx_graph values ('T-cell deficiencies', 'includes', 'DiGeorge syndrome')

insert into dx_graph values ('complement disorders', 'includes', 'C1 esterase inhibitor deficiency')

insert into dx_graph values ('complement disorders', 'includes', 'C5-C9 deficiency')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值