您的当前位置:首页正文

数据库习题6.1

2023-05-24 来源:易榕旅网
6. I

7.

使用大学的模式, 用关系代数来表达下面这些查询。

A. 找出计算机( Comp. Sci. )系开设的占3 个学分的课程的名称。

b 找出选了教师Einstei n 所教课程的所有学生的ID , 注意结果中不能有重复。

c. 找出所有教师的最高工资。

d. 找出收入为最高工资的所有教师(可能有多个人工资相同) 0

e. 找出2∞9 年秋季学期开设的各个课程段的选课人数。

L 找出2∞9 年秋季学期开设的各个课程段中最大的选课人数。

g. 找出在2∞9 年秋季学期选课人数最多的课程段。

a. 5ti tle (sdept name = ’Comp. Sci’ ∧ credits=3(course))

b. 5I D(sI I D = ’Einstein’(takes 1 rt1(IID, course id, section id, semester, year)teaches))

Assuming the set version of the relational algebra is used, there is

no need to explicitly remove duplicates. If the multiset version is

used, the grouping operator can be used without any agggregation

to remove duplicates. For example given relation r (A, B) possibly

containing duplicates, A,BG(r ) would return a duplicate free version

of the relation.

c. Gmax(salary)(instructor)

d. instructor 1 (Gmax(salary) as salary (instructor))

Note that the above query renames the maximum salary as salary, so

the subsequent natural join outputs only instructors with that salary.

e. course id,section idGcount(∗) as enrollment(syear=2009∧

semester=Autumn(takes))

f. t1 ← course id,section idGcount(∗) as enrollment(syear=2009∧semester=Autumn(takes))

result = Gmax(enrollment)(t1)

g. t2 ← Gmax(enrollment) as enrollment(t1)

where t1 is as defined in the previous part of the question.

result = t1 1 t2

因篇幅问题不能全部显示,请点此查看更多更全内容