UGC NET CS 2022Database Management Systems › SQLVerified
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 $\mathrm{R}$ and Boots $\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/queries computes/compute the sid’s of sailors with age over 20 who have not reserved red boat?
- A$\pi$ sid $\left(\delta_{\text {age }}>20\right.$ Sailors $)-\pi$ sid $((\delta$ $_{color}$ $=$ $_{red}$ Boats $) \bowtie$ Reserves $\bowtie$ Sailors $)$Correct answer
- B$\pi$ sid $\left(\left(\delta_{\text {color } \neq}\right.\right.$ red $\wedge$ age $>20$ (Boats $\bowtie$ Sailors $\bowtie$ Reserves $\left.\left.)\right)\right)$
- C$\pi$ sid ( $\delta$ $_{age}$ < 20 Sailors $)-\pi$ sid $((\delta$ $_{color}$ $=$ $_{red}$ Boats $) \bowtie$ Reserves $\bowtie$ Sailors $)$
- D$\pi$ sid $(\delta$ $_{age}$ $>20$ Sailors $) \wedge \pi$ sid $((\delta$ $_{color}$ $=$ $_{red}$ Boats $) \bowtie$ Reserves $\bowtie$ Sailors $)$
Answer
(A) $\pi$ sid $\left(\delta_{\text {age }}>20\right.$ Sailors $)-\pi$ sid $((\delta$ $_{color}$ $=$ $_{red}$ Boats $) \bowtie$ Reserves $\bowtie$ Sailors $)$
Approach
Reviewed by UGC IQ Editorial Team.