Question: 5.4 The following two SQL queries attempt to find the names of sailors with higher ranking and less than 25 years old. SELECT S.sname FROM
5.4 The following two SQL queries attempt to find the names of sailors with higher ranking and less than 25 years old.
SELECT S.sname
FROM Sailors S
WHERE NOT EXISTS ( SELECT *
FROM Sailors S2
WHERE S2.age < 25
AND S.ranking <= S2.ranking );
FROM Sailors S
WHERE S.ranking > ANY ( SELECT S2.ranking
FROM Sailors S2
WHERE S2.age < 25 );
a. Do the two queries calculate the result? If not, explain why. (5 Marks)
b. What conditions will make the two queries obtain the same result? (5 Marks) [Sub Total 25 Marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
