UGC NET CS 2022Database Management Systems › Data ModelingVerified
UGC NET CS 2022 PYQ: Read the following and Answer the questions: Consider the relational schema of sailors $\text{S}$, Reserves…
Read the following and Answer the questions:
Consider the relational schema of sailors $\text{S}$, Reserves $\text{B}$ and Boats $\text{B}$.
Table 1: Sailors $\text{S}$
$$\begin{array}{|l|l|l|l}
\hline Sid & Sname & Ratting & Age \\
\hline 22 & Dustin & 7 & 45.0 \\
29 & Brutus & 1 & 33.0 \\
31 & Lubber & 8 & 55.5 \\
32 & Andy & 8 & 25.5 \\
58 & Rusty & 10 & 35.0 \\
64 & Horatio & 7 & 35.0 \\
71 & Zorba & 10 & 16.0 \\
74 & Horatio & 9 & 35.0 \\
85 & Art & 3 & 25.5 \\
95 & Bob & 3 & 63.5 \\
\hline
\end{array}$$
Table 2: Reserves $\text{R}$
$$\begin{array}{|l|l|l|} \hline sid & Bid & day \\ \hline 22 & 101 & 10 / 1098 \\ 22 & 108 & 101098 \\ 22 & 108 & 101898 \\ 22 & 104 & 10 / 798 \\ 31 & 108 & 11 / 1098 \\ 31 & 103 & 11 / 699 \\ 31 & 104 & 11 / 298 \\ 64 & 101 & 9558 \\ 64 & 102 & 28858 \\ 74 & 103 & 98958 \\ \hline \end{array}$$
Table 3: Boats $\text{B}$
$$\begin{array}{|l|l|l|} \hline Bid & Bname & Color \\ \hline 101 & Interlake & blue \\ 102 & Interlake & red \\ 103 & Clipper & green \\ 104 & Marine & red \\ \hline \end{array}$$
Which of the following relational algebra query computes the names of sailors who have reserved a red and a green boat?
- A$\rho$ (Tempred, $\pi$ sid $\left(\left(\delta_{\text {color }}=\right.\right.$ $_{‘red’}$ Boats $)$ $\bowtie$ Reserves)), $\rho$ (Tempgreen. $\pi$ sid $\left(\left(\delta_{\text {color }}=\right.\right.$ $_{‘green’}$ Boats $)$ $\bowtie$ Reserves)), $\pi$ sname (Tempred $\cap$ Tempgreen) $\bowtie$ SailorsCorrect answer
- B$\rho($ Tempboats 2, $(\delta$ color $=$ $_{‘red’}$ Boats $) \cap(\delta$ color $=$ $_{‘green’}$ Boats $)) \pi$ sname (Tempboats 2 $\bowtie$ Reserves)
- C$\pi$ sname $\left(\left(\delta_{\text {color }}=\right.\right.$ $_{’red’}$ Boats $) \cap\left(\delta_{\text {color }}=\right.$ $_{’green'}$ Boats $)$ (Tempboats $\bowtie$ Sailors $\bowtie$ Reserves))
- D$\rho($ Tempboats 2, $(\delta$ $_{color}$ $=$ $_{red}$ Boats $\delta$ $_{color}$ $=$ $_{‘green’}$ Boats $) \pi$ sname (Tempboats 2 $\bowtie$ sailors)
Answer
(A) $\rho$ (Tempred, $\pi$ sid $\left(\left(\delta_{\text {color }}=\right.\right.$ $_{‘red’}$ Boats $)$ $\bowtie$ Reserves)), $\rho$ (Tempgreen. $\pi$ sid $\left(\left(\delta_{\text {color }}=\right.\right.$ $_{‘green’}$ Boats $)$ $\bowtie$ Reserves)), $\pi$ sname (Tempred $\cap$ Tempgreen) $\bowtie$ Sailors
Approach
Reviewed by UGC IQ Editorial Team.