Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



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/queries computes/compute the name of sailors who have reserved boat $103$?Q1 $\pi_{sname}((\sigma_{bid=103}(Boats))\bowtie Sailors)$Q2 $\pi_{sname}((\sigma_{bid=103}(Reserves\bowtie Sailors)))$Q3 $\pi_{sname}((\sigma_{bid=103}(Reserves))\bowtie Sailors)$





Solution

We need the names of sailors who have reserved boat $103$.

The information about reservation is available in the Reserves table.

So, to find sailors who reserved boat $103$, first select those tuples from Reserves where $bid=103$.

$\sigma_{bid=103}(Reserves)$

Then join this result with Sailors table using $sid$.

Finally, project the sailor names using $\pi_{sname}$.

So, Q3 is correct:

$\pi_{sname}((\sigma_{bid=103}(Reserves))\bowtie Sailors)$

Now check Q2.

In Q2, Reserves is first joined with Sailors.

Then condition $bid=103$ is applied.

After that, sailor names are projected.

This also gives the same correct result.

So, Q2 is also correct.

Now check Q1.

Q1 selects $bid=103$ from Boats and joins it directly with Sailors.

But Boats table and Sailors table do not directly tell which sailor reserved which boat.

The Reserves table is required for this relationship.

So, Q1 is incorrect.

Therefore, both Q2 and Q3 compute the required result.


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...