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 $S$, reserves $R$,…
Read the following and Answer the Questions:
Consider the relational schema of sailors $S$, reserves $R$, and boats $B$.
$$\textbf{Table 1: Sailors } S$$
$$\begin{array}{|c|c|c|c|} \hline \mathrm{Sid} & \mathrm{Sname} & \mathrm{Rating} & \mathrm{Age} \\ \hline 22 & \mathrm{Dustin} & 7 & 45.0 \\ 29 & \mathrm{Brutus} & 1 & 33.0 \\ 31 & \mathrm{Lubber} & 8 & 55.5 \\ 32 & \mathrm{Andy} & 8 & 25.5 \\ 58 & \mathrm{Rusty} & 10 & 35.0 \\ 64 & \mathrm{Horatio} & 7 & 35.0 \\ 71 & \mathrm{Zorba} & 10 & 16.0 \\ 74 & \mathrm{Horatio} & 9 & 35.0 \\ 85 & \mathrm{Art} & 3 & 25.5 \\ 95 & \mathrm{Bob} & 3 & 63.5 \\ \hline \end{array}$$
$$\textbf{Table 2: Reserves } R$$
$$\begin{array}{|c|c|c|} \hline \mathrm{Sid} & \mathrm{Bid} & \mathrm{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}$$
$$\textbf{Table 3: Boats } B$$
$$\begin{array}{|c|c|c|} \hline \mathrm{Bid} & \mathrm{Bname} & \mathrm{Color} \\ \hline 101 & \mathrm{Interlake} & \mathrm{blue} \\ 102 & \mathrm{Interlake} & \mathrm{red} \\ 103 & \mathrm{Clipper} & \mathrm{green} \\ 104 & \mathrm{Marine} & \mathrm{red} \\ \hline \end{array}$$
Which of the following relational algebra query/queries computes the names of sailors who have reserved red boats?
$$Q_1:\ \pi_{\mathrm{Sname}} \left( \sigma_{\mathrm{Color}=\mathrm{red}}(B) \bowtie R \bowtie S \right)$$
$$Q_2:\ \pi_{\mathrm{Sname}} \left( \pi_{\mathrm{Bid}} \left( \pi_{\mathrm{Bid}} \left( \sigma_{\mathrm{Color}=\mathrm{red}}(B) \right) \bowtie R \right) \bowtie S \right)$$
$$Q_3:\ \pi_{\mathrm{Sname}} \left( \sigma_{\mathrm{Color}=\mathrm{red}}(R) \bowtie B \bowtie S \right)$$
- ABoth $Q_1$ and $Q_3$
- BBoth $Q_2$ and $Q_3$
- COnly $Q_1$Correct answer
- DOnly $Q_2$
Answer
(C) Only $Q_1$
Approach
Reviewed by UGC IQ Editorial Team.