GATE / CS ARCHIVE

GATE CSE 2004 / QUESTION 51

Universal comparison through relational difference

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

GATE 2004, Q51 2 marks · MCQ
Report issue

Relational Algebra & Calculus

Question 51, GATE 2004: Student(name,sex,marks), key name, contains at least one boy and one girl. Let ρ_(n,x,m)(Student) rename the three attributes. Interpret π_name(σ_(sex=female)(Student)) − π_name(Student ⋈_(sex=female ∧ x=male ∧ marks≤m) ρ_(n,x,m)(Student)).
Options:
(A) Names of girls with the highest marks
(B) Names of girls with more marks than some boy
(C) Names of girls with marks not less than some boy
(D) Names of girls with more marks than every boy
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. The left expression selects all female names. The right expression finds a female student paired with a male student whose marks m satisfy female marks≤m, and projects that female name.

2. Subtracting these removes every girl for whom at least one boy has marks greater than or equal to hers. Remaining girls therefore have marks greater than EVERY boy.

3. The primary-key name makes the projected subtraction unambiguous, and the stated existence of boys avoids a vacuous comparison.

4. Teaching check: The joined part is an existential counterexample set: it contains a girl if there exists a boy with marks at least hers. Subtracting all such counterexamples converts “there exists a violating boy” into “every boy has fewer marks.” Equality is removed because the join uses ≤.

Original paper, page 7