12 Chapter 6 Formal Relational Query Languages
b. Print names of faculty members who have borrowed all books published
by
Addison-Wesley.
c. For each publisher, print the names of faculty who have borrowed
more
than five books of that publisher.
. .
.8
6.7 Write extended relational algebra expressions to do the following. Assume you
are given two relations, student(name, rollno) and marks(rollno, exam, mark)
6.8 Consider a relation marks(rollno, course, examname, marks).
a. Suppose the course DBIS has two quizzes, and you want to find the max-
imum of the two quiz marks for each student of the course. Assume that
6.9 Let
r
and s be relations with the schema
R(a1,
a2) and
S(a1,
a3)
respectively.
The semijoin operation
r
⋉ s selects tuples from
r
that match with some tuple
in s. The semijoin operation can be defined as Πa1,a2
(r
✶
s). (Here,
✶
is the
natural join where common attributes appear only once.)
Consider the relational algebra with
duplicates.
a. Define (in words) the multiset versions of Π, σ and
✶
.
. . .5
b. Define the multiset version of
⋉
as containing the same
s
e
t
of tuples in
r
⋉
s,
but each tuple has the same multiplicity as it has in
r.
For example if
r =
{
(
1
,
2), (1, 2), (2,
3
)
}
and s
=
{
(
1
,
4), (1,
5
)
}
,
r
⋉ s
=
{
(
1
,
2), (1,
2
)
}
,
whereas
6.10 Given relations
r(A,
B), and s(A,
C
)
:
a. Give an expression in SQL that is equivalent to
B
G
(
Π
B
C
(r
✶
s
))
.
6.11 Given the schema
item(itemid, name, category, price)