Log In
0 votes

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
edited by
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 .

@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

2 votes
1 answer
$Emp$ $(eid: integer, ename: string, age: integer, salary :real)$ $Works$ $(eid: integer, did: integer, pct_time: integer)$ $Dept$ $(did: integer, budget: real, managerid: integer)$ $CREATE$ $VIEW$ $AvgsalaryByAge (age, AvgSalary) AS$ ... updated automatically. The above view on Emp can be updated automatically by updating Emp. The above view cannot be created automatically. None of the above
asked Dec 27, 2017 in Databases Harsh Mehta 300 views
0 votes
1 answer
According to me it should be – “Retrieve the names of all students with a lower rank, than all students with age < 18 ”
asked Dec 24, 2018 in Databases Shubhanshu 381 views
1 vote
0 answers
You executed the following SQL statements in the given order: CREATE TABLE orders (order_id NUMBER(3) PRIMARY KEY, order_date DATE, customer_idnumber(3)); INSERT INTO orders VALUES (100,'10-mar-2007',222); ALTER TABLE orders MODIFY order_date NOT NULL; UPDATE orders ... D.All the statements up to the ALTER TABLE statement would be committed and the outcome of UPDATE statement would be rolled back.
asked Dec 11, 2017 in Databases shaurya vardhan 173 views