GATE DA 2025 | 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_{\texttt{owner}}(\texttt{Own} \bowtie (\sigma_{\texttt{color}=\text{“}\mathit{red}\text{”}}(\texttt{Car} \bowtie (\sigma_{\texttt{maker}=\text{“}\mathit{ABC}\text{”}}\texttt{Make}))))\]
Which one of the following options describes what the above expression computes?
Explanation
Answer: (C)
Evaluate the expression from the innermost part outwards.
- \(\sigma_{\texttt{maker}=\text{“}\mathit{ABC}\text{”}}\texttt{Make}\) keeps the models that ABC makes.
- Joining with
Car(onmodel) keeps only cars of those models, and \(\sigma_{\texttt{color}=\text{“}\mathit{red}\text{”}}\) then keeps the red ones. Both conditions hold for the same car. - Joining with
Own(onserial) pairs each such car with its owners, and \(\pi_{\texttt{owner}}\) keeps only the owners.
The result is every owner of a red car made by ABC. Option A would need a union of separate selections, B needs a count that the expression never takes, and D describes cars although the projection outputs owners.
Answer: C