本文介绍了关系代数和混淆一个复杂的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有3个关系:

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

找到这些学生参加CS部门中所有课程的学生数量。

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

任何人都可以说(第1行)到(第3行)。我在DB中的Solved-Ex中读到了。

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

推荐答案

第四行的另一种说法是:

Another way to phrase the fourth line is:

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

括号内的集合包含所有未采用的学生+ CS课程组合。从所有学生中减去这个,你得到的所有CS考试的学生。

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.

这篇关于关系代数和混淆一个复杂的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 12:02