GateAI
Relational Model and SQL

GATE CSE 2014 Set 3 · Q30

MCQ2 marksMedium

Time

Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation. employee (empId, empName, empAge)dependent (depId, eId, depName, depAge)

Consider the following relational algebra query: ΠempId(employee)−ΠempId(employee⋈(empId=eId)∧(empAge≤depAge)dependent)\Pi_{\mathtt{empId}} (\mathtt{employee}) - \Pi_{\mathtt{empId}} (\mathtt{employee} \bowtie_{(\mathtt{empId} = \mathtt{eId}) \wedge (\mathtt{empAge} \le \mathtt{depAge})} \mathtt{dependent}) The above query evaluates to the set of empIds of employees whose age is greater than that of

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) all of his/her dependents.

Relational Model and SQL

Let us analyze the query step-by-step:

  1. The right-hand side subexpression:

ΠempId(employee⋈(empId=eId)∧(empAge≤depAge)dependent)\Pi_{\mathtt{empId}} (\mathtt{employee} \bowtie_{(\mathtt{empId} = \mathtt{eId}) \wedge (\mathtt{empAge} \le \mathtt{depAge})} \mathtt{dependent})

selects the empId of all employees who have at least one dependent whose age is greater than or equal to the employee's age (i.e., empAge≤depAge\text{empAge} \le \text{depAge}).

  1. The outer operation is a set difference:

ΠempId(employee)−Right Subexpression\Pi_{\mathtt{empId}} (\mathtt{employee}) - \text{Right Subexpression}

This removes all employees who have at least one dependent with empAge≤depAge\text{empAge} \le \text{depAge} from the set of all employees.

  1. Since every employee is given to have at least one dependent, the remaining employees are those for whom no dependent satisfies empAge≤depAge\text{empAge} \le \text{depAge}, which means that for all of his/her dependents, empAge>depAge\text{empAge} > \text{depAge}.

Therefore, the query returns the set of employees whose age is greater than that of all of his/her dependents (Option D).

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 Q30 of the GATE CSE 2014 Set 3 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. 8 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2014 Set 3.

How GATE tests Relational Model and SQL

More from GATE CSE 2014 Set 3

Share this solution

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

GateAI solution cardGATE CSE 2014 Set 3 · Q30 · MCQ

Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee . Assume that every employee has at least one associated dependent in the dependent relation. employee (empId, empName, empAge) dependent (depId, eId, depName, depAge) Consider the following relational algebra query: empId ( employee) - empId ( employee ( empId = eId) ( empAge ≤ depAge) dependent) The above query evaluates to the set of empId s of employees whose age is greater than that of

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.