Relational Algebra and Confusing one Complex Examples

笑着哭i 提交于 2019-12-11 03:38:30

问题


We have 3-Relation:

Students(sid, sname)
Courses(cid, cname, dept)
take(sid, cid, grade)

We want to find student numbers of students whose these students take all courses that present in 'CS' department.

why (line 4) is the answer of this query ?

anyone could say differ from (line 1) to (line 3). I read this in Solved-Ex in DB.


回答1:


Another way to phrase the fourth line is:

all students
except
(
    all combinations of students and CS courses
    except
    all taken courses
)

The set between brackets contains all student + CS course combinations that were not taken. Subtract this from all students, and you get the students that did take all CS exams.



来源:https://stackoverflow.com/questions/28942035/relational-algebra-and-confusing-one-complex-examples

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!