GATE CS 2004 · SQL Queries

MCQ · 1 mark · Problem DBMS-SQL-0144

Consider the relation Student (\(\underline{name}\), sex, marks), where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. What does the following relational algebra expression produce? (Note: \(\rho\) is the rename operator.)\[\Pi_{name}\big(\sigma_{sex = female}(Student)\big) - \Pi_{name}\big(Student \bowtie_{(sex = female \,\wedge\, x = male \,\wedge\, marks \le m)} \rho_{n,x,m}(Student)\big)\]
  1. A
    names of girl students with the highest marks
  2. B
    names of girl students with more marks than some boy student
  3. C
    names of girl students with marks not less than some boy student
  4. D
    names of girl students with more marks than all the boy students

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{\text{all girls} - \text{girls with marks} \le \text{some boy's marks}}\]The join pairs a girl with a boy (renamed \(n, x, m\)) whenever the girl's marks are at most the boy's. Its projection gives every girl who does not beat some boy.Removing them from all girls leaves the girls who score more than every boy.Answer: D

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com