关系代数“仅一次",即“仅一次".或“存在一次" [英] Relational Algebra "Only Once" or "Exists once"
问题描述
所以我有2种关系
Student = {student id, name, address}
Course = {course no, title, subject}
Completed = {course no, student id, grade, semester}
我想显示仅完成一个物理"课程(这是一门学科)的学生的姓名
and I want to display the name of students who have COMPLETED only one COURSE of "Physics" (Which is a subject)
我在连接表以将数据收集在一起时没有问题,我的问题是如何获取仅出现一次的值?
I dont have problems joining the tables to get the data together, my problem is with how to get values that appear only once?
到目前为止我有什么
PICourse_no (σ Subject=´Physics´(COURSE))
这使我获得了所有与物理相关的课程编号
That gets me all the course numbers that are Physics related
PIStudent_Id(σCourseNo= (PICourse_no (σ Subject=´Physics´(COURSE))))
有了这个,我想我得到了所有与物理相关课程学习的学生的身份证...但是现在这是我的问题,我该如何删除比一门与物理相关课程更多的学生? /p>
And with that I think I'm getting the Id's of all the students who study a physics related course...but now here is my problem, how do I remove the students who have MORE than one physics related course?
推荐答案
我该如何删除比一门与物理相关的课程更多的学生?"
"how do I remove the students who have MORE than one physics related course?"
这是由关系MINUS运算符或其侄子之一(有时称为反联接)完成的.正如评论中指出的那样,存在大量不同的算子集,都称为关系代数".您确实必须查看应该使用哪一个.
That is done by the relational MINUS operator or one of its nephews (sometimes known as antijoin). As indicated in the comments, there are a major number of distinct sets of operators all called "relational algebra". You really have to look into which one you are supposed to be using.
这篇关于关系代数“仅一次",即“仅一次".或“存在一次"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!