Skip to content

ISRO Scientist/Engineer CSE 2017Databases › Relational Algebra and ER Model

ISRO Scientist/Engineer CSE 2017 PYQ: Consider the following schema: $\text{Sailors(sid,sname,rating,age)}$ $\text{Boats(bid,bname,colour)}$…

Consider the following schema:

$\text{Sailors(sid,sname,rating,age)}$
$\text{Boats(bid,bname,colour)}$
$\text{Reserves(sid,bid,day)}$

Two boats can have the same name but the colour differentiates them.

The two relations

$\rho (Tempsids,(\pi _{sid,bid}\,Reserves)/(\pi_{bid}(\sigma_{bname='Ganga'}\,Boats ))),$
$\pi_{sname}(Tempside\Join Sailors)$

If $/$ is division operation, the above set of relations represents the query

  1. A
    Names of sailors who have reserved all boats called Ganga.
    Correct answer
  2. B
    Names of sailors who have not reserved any Ganga boat.
  3. C
    Names of sailors who have reserved at least one Ganga boat.
  4. D
    Names of sailors who have reserved at most one Ganga boat.

Answer

(A) Names of sailors who have reserved all boats called Ganga.

Approach

The division operator R ÷ S is defined as returning every value of the non-divisor attributes that is paired with every tuple in S. Here R is π_sid,bid(Reserves), which lists all sailor-boat reservation pairs, and S is π_bid(σ_bname='Ganga'(Boats)), which lists the bids of every boat whose name is Ganga. Thus, Tempsids = π_sid,bid(Reserves) ÷ π_bid(σ_bname='Ganga'(Boats)) contains exactly those sid values for which the sailor has a reservation pair with every bid in S. In other words, each sailor in Tempsids has reserved every boat named Ganga. The subsequent join with Sailors and projection of sname simply returns the names of those sailors. This directly matches option A. Option C would correspond to a simple selection/join, because it only requires at least one Ganga reservation. Option B would require anti-join or set difference to find sailors with no Ganga reservation at all. Option D would require counting reservations and comparing the count to 1, which is not what division computes. The note that two boats can have the same name but different colours is consistent with the query: the divisor uses bid, so multiple Ganga boats with the same name but different bids are all included. Therefore a sailor must have reserved all distinct Ganga boat ids, i.e., all boats called Ganga. Both the primary solver and the independent verifier reached the correct conclusion; the only flagged issue was a self-flagged review, not an actual contradiction.

Reviewed by ISRO IQ Editorial Team.