GATE / CS ARCHIVE

GATE CSE 2001 / QUESTION 21(a)

Find duplicate examinee names

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 2001 paper

GATE 2001, Q21(a) Descriptive
Report issue

Relational Algebra & Calculus

Question 21(a), GATE 2001: examinee(regno,name,score), with primary key regno. Use projection, selection, renaming and Cartesian product to find names appearing in multiple tuples.
Question 21(a), GATE 2001: examinee(regno,name,score), with primary key regno. Use projection, selection, renaming and Cartesian product to find names appearing in multiple tuples.
Tap to enlarge
Answer & solution

Answer: π_X.name σ_(X.name=Y.name ∧ X.regno≠Y.regno)(ρ_X(examinee) × ρ_Y(examinee)). (no official key was published)

Rename the relation twice so the two tuple occurrences are distinguishable: X=ρ_X(examinee), Y=ρ_Y(examinee). Form X×Y, retain equal names but different registration numbers, then project the name.

π_X.name(σ_(X.name=Y.name AND X.regno≠Y.regno)(X×Y)).

The equal-name condition identifies candidates; the unequal-key condition ensures two different examinees rather than pairing a row with itself. Because regno is a key, different regno values mean different rows. Standard relational algebra has set semantics, so projection returns each repeated name once even if it has many matching pairs. Example: (1,Asha,70),(2,Asha,80),(3,Bela,90) returns only Asha. Without the unequal-key predicate every name would incorrectly qualify.

Original paper, page 10