The Gateway to Computer Science Excellence
+34 votes

Consider the following relational schema.

  • Students(rollno: integer, sname: string)
  • Courses(courseno: integer, cname: string)
  • Registration(rollno: integer, courseno: integer, percent: real)

Which of the following queries are equivalent to this query in English?

“Find the distinct names of all students who score more than 90% in the course numbered 107”

  1. SELECT DISTINCT S.sname FROM Students as S, Registration
        as R WHERE 
        R.rollno=S.rollno AND R.courseno=107 AND R.percent >90
  2. $∏_{sname}(σ_{courseno=107 ∧ percent > 90} (Registration ⋈ Students))$
  3. $\{T \mid ∃S \in Students, ∃R \in Registration ( S.rollno=R.rollno$
    $∧ R.courseno=107 ∧ R.percent>90 ∧T.sname=S.sname) \}$
  4. $\left\{ \langle S_N\rangle \mid ∃S_R∃R_P (\langle S_R,S_N\rangle ∈Students ∧ \\ \langle S_R,107,R_P\rangle ∈Registration ∧ R_P>90) \right\}$
  1. I, II, III and IV
  2. I, II and III only
  3. I, II and IV only
  4. II, III and IV only
in Databases by Veteran (431k points)
edited by | 4.2k views

beautiful qestion to apply it all yes

@Arjun Sir please help. There is no attribute name (T.attrname) given in left side of '|' in choice 3. Then how is it correct?
Hello Arjun Sir, Can u please help me to understand , we have not included joining condition in Option 2 (Relational Algebra) , so it can be correct?

TRC and DRC ->

I think in third part. $T∈Students$ is missing. Ideally it should be -

$ \left \{   T ∣  T∈Students  ∧ ∃S∈Students,∃R∈Registration(S.rollno=R.rollno∧R.courseno=107∧ R.percent>90∧T.sname=S.sname) \right \}$

Refer -


it is not necessary according to this image

In DRC, for all the attributes in a table the variables shld b mentioned right

ex: student(a,b,c,d)

but in 4th option only required var is mentioned!

in this case how the system identifies a var is assigned to a particular attribute in a table?

Why not T.sname in 3rd option? It is causing hell a lot of confusion. In every other TRC question the attribute to be printed is given in LHS of |.

Please someone explain the IV query.
TRC & DRC removes duplicate result same as the DISTINCT keyword in SQL.

1 Answer

+31 votes
Best answer
Answer: A

Four queries given in SQL, RA, TRC and DRC in four statements respectively retrieve the required information.
by Boss (33.9k points)
selected by
In the third option, No range relation for T is specified ?

e.g. A simple tuple relational calculus expression is :

{ t | Relation_Name(t) ^ Condition(t) } where

"Relation_Name" is the range of the relation and "Condition" is any logical expression.

Please, let me know where I am wrong? Thanks ^_^

but how is the tuple caculus query correct 
it prints the whole tupple but it is asked to print only student name to
it should be 



@hkara That's not how tuple relation calculus defines tuple selection. You can see here:

how is T in 3rd query gives only T.sname ? why is it not printing the entire row?
because t is a tupple variable with only one attribute sname
@Arjun sir,

Here there is nothing like there exist T that belongs to student, so how in first place is T.sname= comparison occuring????


Here there is no joining condition like Registeration.rollno=Students.rollno is given

"(Registration⋈Students) ", It is NATURAL JOIN, an implicit equijoin condition is specified for each pair of attributes with same name in both relations so there is no need to apply separate joining condition
How is the 3rd query  correct?.. T is a tuple variable, but it is not defined that on which table it ranges...?

And also there are no brackets between the and conditions so how will it decide precedence?  

Please do throw some light.. :)
@Arjun sir. TRC DRC results are distinct always?
how drc is working explain please

@rahul sharma 5

yes , TRC and DRC returns distinct results .

If you find it is wrong please reply , i also had same doubt


@mehul vaidya

Do TRC and DRC return distinct results (here in case two students with same name & course 107 & 90 % and different roll nos )...above link is not so useful..



I think this will answer all the above questions -

1. How is T in 3rd query gives only T.sname ? why is it not printing the entire row?
2. Why range relation is not specified ?

Reference 1 -
Reference 2 - here

. TRC DRC results are distinct always?

The result of a TRC query is a relation. A relation is defined as a "set" means relations don't contain duplicate elements.

Thanks man! It helped a lot.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,353 answers
105,247 users