GateAI
Relational Algebra

GATE CSE 2021 Set 1 · Q27

MCQ2 marksMedium

Time

The following relation records the age of 500 employees of a company, where empNoempNo (indicating the employee number) is the key: empAge(empNo‾,age)empAge(\underline{empNo}, age) Consider the following relational algebra expression: ΠempNo(empAge⋈(age>age1)hoempNo1,age1(empAge))\Pi_{empNo}(empAge \bowtie_{(age > age1)} ho_{empNo1, age1}(empAge)) What does the above expression generate?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) Employee numbers of all employees whose age is not the minimum.

Relational Algebra

Let us analyze the given relational algebra expression step by step:

  1. Renaming: hoempNo1,age1(empAge)ho_{empNo1, age1}(empAge) creates a copy of the relation empAgeempAge with attributes renamed to (empNo1,age1)(empNo1, age1).

  2. Theta Join: The join condition is age>age1age > age1:

    empAge⋈(age>age1)hoempNo1,age1(empAge)empAge \bowtie_{(age > age1)} ho_{empNo1, age1}(empAge)

    This condition pairs an employee from the first relation with any employee in the second relation who has a strictly smaller age.

  3. Condition for inclusion: A tuple from empAgeempAge appears in this join result if and only if there exists at least one tuple in the relation whose age is strictly less than this employee's age (age>age1age > age1).

    • For an employee with the minimum age, there is no employee in the table with an age strictly less than theirs. Thus, their tuple fails the join condition and does not appear in the result.

    • For every other employee (whose age is strictly greater than at least one other employee), their tuple satisfies the condition and is included.

  4. Projection: ΠempNo(… )\Pi_{empNo}(\dots) selects the employee numbers (empNoempNo) of all tuples surviving the join.

Therefore, the expression returns the employee numbers of all employees whose age is not the minimum, which corresponds to option (C).

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 Algebra previous year question is Q27 of the GATE CSE 2021 Set 1 paper. Find more GATE CSE PYQs on Relational Algebra 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 4 related Relational Algebra 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 Algebra in GATE CSE

Relational Algebra has 4 GATE CSE PYQs across 4 papers from 2012 to 2024. 2 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2021 Set 1.

How GATE tests Relational Algebra

More from GATE CSE 2021 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2021 Set 1 · Q27 · MCQ

The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key: empAge( empNo, age) Consider the following relational algebra expression: empNo(empAge (age > age1) hoempNo1, age1(empAge)) What does the above expression generate?

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.