The Gateway to Computer Science Excellence
0 votes
93 views

I got why query 2 is wrong. How do I approach to understand Query 1, is there a generic approach for solving questions like these which have no tables given?

in Databases by Active (1.9k points)
edited by | 93 views
+3
First of all It is a co-related sub query . Now as you can observe , the NOT EXISTS clause is used . So the outer query will print a tuple if and only if the inner query returns nothing .

That is if at least one person who is of age less than 22 , and has rating greater than or equal to the rating of the sailor of the outer query , then the outer query shall not print anything .

So only if there is no such sailor whose age is less than 22 , and has rating greater than or equal to some sailor of the outer query , only then a sailor name shall be printed .
0

@amitqy bro if you have enough practice then you can apply what @prashant jha 1 said ,otherwise solve it by taking a small table by yourself.

Please log in or register to answer this question.

Related questions

+1 vote
1 answer
4
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,306 answers
198,316 comments
105,012 users