edited by
17,858 views
65 votes
65 votes

Consider the relation Student (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).

$\displaystyle \pi_{name} \{\sigma_{sex=female} (\text{Student}) \} - \pi_{name} (\text{Student}\bowtie _{(sex=female \wedge x=male \wedge marks \leq m)} \rho_{n, x, m}(\text{Student}))$

  1. names of girl students with the highest marks
  2. names of girl students with more marks than some boy student
  3. names of girl students with marks not less than some boy student
  4. names of girl students with more marks than all the boy students
edited by

7 Answers

1 votes
1 votes

THIS MIGHT HELP

Observe that A) cannot be the answer because when checking an extreme condition i.e. lowest marks it'll give tuples NOT FOR THE HIGHEST MARKS OF GIRL STUDENT

As this relational algebra is giving output as Nitisha & Shimonti. 

Also note that if you go for another extreme i.e. highest marks 98 then it'll give you 0 tuples because the top scorer NITISHA will also get deleted.

Therefore answer is D.

(NOTE:- Stud subscript 'xyz' is for convenience only don't bother about it)

 

 

0 votes
0 votes

1st  -  Πname(σsex=F(Student)) - Here we get all female student name.

 

2nd  - πname(Student(sex=female∧x=male∧marks≤m)ρn,x,m(Student)) - Here every female student is mapped to male students then from condition  (marks≤m)  we get all female student whose marks is less than male students.

1st - 2nd give name of female student whose mark is greater than male student.

ans-D

0 votes
0 votes
Intuitively thinking its a division problem.

All girls name(distinct) – Girls name wholes marks less than any boy.
Answer:

Related questions

26 votes
26 votes
2 answers
2
Kathleen asked Sep 18, 2014
11,334 views
The order of an internal node in a $B+$ tree index is the maximum number of children it can have. Suppose that a child pointer takes $6$ bytes, the search field value tak...