gpt4 book ai didi

sql - 关系代数

转载 作者:搜寻专家 更新时间:2023-10-30 22:20:23 25 4
gpt4 key购买 nike

你能帮我用关系代数解决这个问题吗?我有这个 DB(论文答辩);

  • 教师(Teacher_ID、姓名、专业)
  • 项目(Project_ID、职位、专业)
  • 论文(Thesis_ID、Project_ID、Jury_ID、Decision)
  • 陪审团(Jury_ID、主管_ID、First_Member_ID、Second_Member_ID)

我想找到代数查询来获得指导他们专业论文的教师(ID,姓名);

我已经用 SQL 完成了,它应该是这样的:

Select Teacher_ID, Name  
From Teachers T
Where Teacher_ID IN
(Select Supervisor_ID
From Juries
Where Jury_ID IN
(Select Jury_ID
From Thesis
Where Project_ID IN
(Select Project_ID
From Projects P
Where T.Specialty = P.Specialty)))

感谢您的帮助!

最佳答案

你要这样做吗?

select Te.Teacher_ID,Te.Name from thesis t
join project P on (T.Speciality =P.Speciality)
join Juries J on ( J.jury_ID = T.Jury_id)
join Teacher Te on (Te.Teacher_ID = J.Supervisor_ID)

关于sql - 关系代数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4835555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com