Practice Exercises
5
d.
{
t
 ∃
p
∈
r
∃
q
∈
s
(
t
[
A
]
=
p
[
A
]
∧
t
[
F
]
=
q
[
F
]
∧
p
[
C
]
=
q
[
D
]
}
6.6
Let
R
=
(
A
,
B
,
C
), and let
r
1
and
r
2
both be relations on schema
R
. Give
an expression in the domain relational calculus that is equivalent to each
of the following:
a.
A
(
r
1
)
b.
B
=
17
(
r
1
)
c.
r
1
∪
r
2
d.
r
1
∩
r
2
e.
r
1
−
r
2
f.
A
,
B
(
r
1
)
B
,
C
(
r
2
)
Answer:
a.
{
<
t
>
 ∃
p
,
q
(
<
t
,
p
,
q
>
∈
r
1
)
}
b.
{
<
a
,
b
,
c
>

<
a
,
b
,
c
>
∈
r
1
∧
b
=
17
}
c.
{
<
a
,
b
,
c
>

<
a
,
b
,
c
>
∈
r
1
∨
<
a
,
b
,
c
>
∈
r
2
}
d.
{
<
a
,
b
,
c
>

<
a
,
b
,
c
>
∈
r
1
∧
<
a
,
b
,
c
>
∈
r
2
}
e.
{
<
a
,
b
,
c
>

<
a
,
b
,
c
>
∈
r
1
∧
<
a
,
b
,
c
>
∈
r
2
}
f.
{
<
a
,
b
,
c
>
 ∃
p
,
q
(
<
a
,
b
,
p
>
∈
r
1
∧
<
q
,
b
,
c
>
∈
r
2
)
}
6.7
Let
R
=
(
A
,
B
) and
S
=
(
A
,
C
), and let
r
(
R
) and
s
(
S
) be relations. Write
expressions in relational algebra for each of the following queries:
a.
{
<
a
>
 ∃
b
(
<
a
,
b
>
∈
r
∧
b
=
7)
}
b.
{
<
a
,
b
,
c
>

<
a
,
b
>
∈
r
∧
<
a
,
c
>
∈
s
}
c.
{
<
a
>
 ∃
c
(
<
a
,
c
>
∈
s
∧ ∃
b
1
,
b
2
(
<
a
,
b
1
>
∈
r
∧
<
c
,
b
2
>
∈
r
∧
b
1
>
b
2
))
}
Answer:
a.