GATE 2025 DA – Question 17
Consider the following three relations:
Car (model, year, serial, color)
Make (maker, model)
Own (owner, serial)
A tuple in Car represents a specific car of a given model, made in a given year, with a serial number and a color. A tuple in Make specifies that a maker company makes cars of a certain model. A tuple in Own specifies that an owner owns the car with a given serial number. Keys are underlined; (owner, serial) together form key for Own. ($\bowtie$ denotes natural join)
$$\pi_{owner}\left(Own \bowtie \left(\sigma_{color = \text{"red"}}\left(Car \bowtie \left(\sigma_{maker = \text{"ABC"}}Make\right)\right)\right)\right)$$
Which one of the following options describes what the above expression computes?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) All owners of a red car made by ABC
Explanation
Working from the inside, $\sigma_{maker = "ABC"}Make$ keeps the models made by ABC. Joining it with Car on the model gives the cars of those models, and selecting $color = "red"$ keeps the red ones. Joining with Own on the serial number gives the owners of those cars, and projecting on owner lists them. So the result is the set of owners of a red car made by ABC.