GateAI
Relational Model and SQL

GATE CSE 2022 · Q25

MSQ1 markMedium

Time

Consider the following three relations in a relational database. Employee(eId‾,Name)Employee(\underline{eId}, Name), Brand(bId‾,bName)Brand(\underline{bId}, bName), Own(eId‾,bId‾)Own(\underline{eId}, \underline{bId}) Which of the following relational algebra expressions return the set of eIdseIds who own all the brands?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified solution

Official answer: A) eId ( eId, bId(Own) / bId(Brand)); B) eId(Own) - eId(( eId(Own) × bId(Brand)) - eId, bId(Own))

Relational Model and SQL

To find the set of eIdeIds who own all the brands listed in the BrandBrand relation, we use the relational division operation:

ΠeId,bId(Own)/ΠbId(Brand)\Pi_{eId, bId}(Own) / \Pi_{bId}(Brand)
  • Option A: ΠeId(ΠeId,bId(Own)/ΠbId(Brand))\Pi_{eId} (\Pi_{eId, bId}(Own) / \Pi_{bId}(Brand)) correctly divides the pairs (eId,bId)(eId, bId) in OwnOwn by all bIdbIds in BrandBrand. The resulting schema already consists solely of eIdeId, so the outer projection ΠeId\Pi_{eId} retains the correct result. Hence, A is correct.

  • Option B: Relational division R(A,B)/S(B)R(A, B) / S(B) expressed in terms of fundamental relational algebra operations is:

    ΠA(R)−ΠA((ΠA(R)×S)−R)\Pi_A(R) - \Pi_A((\Pi_A(R) \times S) - R)

    Substituting R=ΠeId,bId(Own)R = \Pi_{eId, bId}(Own) and S=ΠbId(Brand)S = \Pi_{bId}(Brand) gives:

    ΠeId(Own)−ΠeId((ΠeId(Own)×ΠbId(Brand))−ΠeId,bId(Own))\Pi_{eId}(Own) - \Pi_{eId}((\Pi_{eId}(Own) \times \Pi_{bId}(Brand)) - \Pi_{eId, bId}(Own))

    This finds all eIdeIds and removes those who are missing at least one brand from BrandBrand. Hence, B is correct.

  • Option C: Dividing by ΠbId(Own)\Pi_{bId}(Own) only finds employees who own all brands that are owned by *at least one* employee, which may not be the complete set of brands in BrandBrand. Hence, C is incorrect.

  • Option D: The Cartesian product ΠeId(Own)×ΠbId(Own)\Pi_{eId}(Own) \times \Pi_{bId}(Own) generates artificial pairings of every employee with every owned brand, losing the actual ownership information from OwnOwn. Hence, D is incorrect.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Relational Model and SQL previous year question is Q25 of the GATE CSE 2022 paper. Find more GATE CSE PYQs on Relational Model and SQL in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Relational Model and SQL PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Relational Model and SQL in GATE CSE

Relational Model and SQL has 15 GATE CSE PYQs across 12 papers from 2011 to 2026. This is the only 1-mark MSQ among them, and it is the only one in GATE CSE 2022.

How GATE tests Relational Model and SQL

More from GATE CSE 2022

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2022 · Q25 · MSQ

Consider the following three relations in a relational database. Employee( eId, Name), Brand( bId, bName), Own( eId, bId) Which of the following relational algebra expressions return the set of eIds who own all the brands?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.