Aspire Faculty ID #18745 · Topic: UGC NET Computer Science Sep 2022 (Paper II) · Just now
UGC NET Computer Science Sep 2022 (Paper II)

Consider the relational schema of sailors $S$, Reserves $R$ and Boats $B$.Table 1: Sailors $S$
SidSnameRatingAge
22Dustin745.0
29Brutus133.0
31Lubber855.5
32Andy825.5
58Rusty1035.5
64Horatio735.5
71Zorba1016.0
74Horatio935.0
85Art325.5
95Bob363.5
Table 2: Reserves $R$
SidBidday
2210110/10/98
2210210/10/98
2210310/8/98
2210410/7/98
3110211/10/98
3110311/6/98
3110411/12/98
641019/5/98
641029/8/98
741039/8/98
Table 3: Boats $B$
BidBnameColor
101Interlakeblue
102Interlakered
103Clippergreen
104Marinered
Which of the following relational algebra query computes the names of sailors who have reserved a red and a green boat?

Solution

We need the names of sailors who have reserved both types of boats:

Red boat

Green boat

First, find sailors who reserved a red boat.

Red boats are selected by:

$\sigma_{color='red'}(Boats)$

Now join this with Reserves table, because Reserves table contains the information about which sailor reserved which boat.

$\pi_{sid}((\sigma_{color='red'}(Boats))\bowtie Reserves)$

This gives the $sid$ of sailors who reserved a red boat.

Rename this result as:

$Tempred$

So,

$Tempred=\pi_{sid}((\sigma_{color='red'}(Boats))\bowtie Reserves)$

Now, find sailors who reserved a green boat.

Green boats are selected by:

$\sigma_{color='green'}(Boats)$

Join with Reserves table and project $sid$:

$\pi_{sid}((\sigma_{color='green'}(Boats))\bowtie Reserves)$

Rename this result as:

$Tempgreen$

So,

$Tempgreen=\pi_{sid}((\sigma_{color='green'}(Boats))\bowtie Reserves)$

Now, sailors who reserved both red and green boats will be obtained by intersection:

$Tempred\cap Tempgreen$

This gives common $sid$ values.

Finally, join this result with Sailors table to get sailor names:

$\pi_{sname}((Tempred\cap Tempgreen)\bowtie Sailors)$

Therefore, option (a) correctly finds sailors who reserved both a red and a green boat.

Previous 10 Questions — UGC NET Computer Science Sep 2022 (Paper II)

Nearest first

Next 10 Questions — UGC NET Computer Science Sep 2022 (Paper II)

Ascending by ID
1
A $3000\ km$ long trunk operates at $1.536\ mbps$ and is used to transmit $64$ bytes frames and uses sliding window pro…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
2
A $3000\ km$ long trunk operates at $1.536\ mbps$ and is used to transmit $64$ bytes frames and uses sliding window pro…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
3
A $3000\ km$ long trunk operates at $1.536\ mbps$ and is used to transmit $64$ bytes frames and uses sliding window pro…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
4
A $3000\ km$ long trunk operates at $1.536\ mbps$ and is used to transmit $64$ bytes frames and uses sliding window pro…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
5
A $3000\ km$ long trunk operates at $1.536\ mbps$ and is used to transmit $64$ bytes frames and uses sliding window pro…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
6
Which Metrics are derived by normalizing quality and/or productivity measures by considering the size of the software t…
Topic: UGC NET Computer Science Sep 2022 (Paper II)
7
 The model in which the requirements are implemented by its category is
Topic: UGC NET Computer Science Sep 2022 (Paper II)
8
Which of the following is an indirect measure of product?
Topic: UGC NET Computer Science Sep 2022 (Paper II)
9
Modules X and Y operate on the same input and output, then the cohesion is
Topic: UGC NET Computer Science Sep 2022 (Paper II)
10
Which mode is a block cipher implementation as a self synchronizing stream cipher?
Topic: UGC NET Computer Science Sep 2022 (Paper II)
Ask Your Question or Put Your Review.

loading...