The Gateway to Computer Science Excellence
0 votes
158 views

According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”

in Databases by Boss (18.3k points)
edited by | 158 views
0

If we take the following table, ignoring other irrelevant attributes:
 

Age Rank
15 1
16 2
17 3
18 4
20 5

 


I think the rows returned will be 17,18 and 20 because for them, there exists no student who is less than 18 and has a higher rank than them. (Eg: The student with age 17 will be compared row wise with students with age 15,16 and 17. Now since the ranks of 17 is not less than any of them, none of the values will be selected, which will make NOT EXISTS to be true.)

So I think it should be None? 

If you see any mistake, do point out. 

0
It should be D I guess...
0

@anjali007 how you got D? At first glance, it seems that D is the correct answer, but the answer should be none of these unfortunately not given in the question.

0
I think the answer should be C .
0
Their provided answer is D but ATM it should be NONE.
0
I am also getting D. whats wrong with it??
0

@Shubhanshu The internal query gives us the name of all the students who have got a rank less than the rank of a person of age 18. So our condition is not exists that means in our final output we should have only those who have got rank >= to that of those with age less than 18 here = is not mentioned .. I assumed that RANKS ARE UNIQUE so got D .

+1

"Retrieve the names of all students with a lower rank, than all students with age < 18 ”

Yes, you are correct. The query will return above statement. None of the options is matching.

0

@ ,if in option (d),S1.RANK<= S2.RANK ,then it would have been correct,am I correct?

 

0

internal query for above table only returns 15 and 16 right? then, how are you saying all persons with rank less than 18? because, in the above case itself, it doesn't return 17. So, not exists will return 17,18,20. Right?

@anjali007

0

@codingo1234

I don't think thats the right correction. There is always only 1 case failing from <18 case. Like, with the table above which is 17. With that condition, I think 15 and 16 will also be valid!

Please log in or register to answer this question.

Related questions

0 votes
1 answer
2
asked Jun 29, 2018 in Databases by Na462 Loyal (7k points) | 115 views
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,292 answers
198,230 comments
104,911 users