This is an Instance of Sailors Relation
$$\overset{\text{Sailors Table}} { \begin{array}{|l|l|} \hline \text{S_ID} & \text{S_Name} & \text{Rating} & \text{Age} \\ \hline 18 & \text{Jones} & 3 & 30.00 \\ \hline 41 & \text{Jonah} & 6 & 56.00 \\ \hline 22 & \text{Ahab} & 7 & 44.00 \\ \hline 63 & \text{Moby} & \text{Null} & 15.00 \\ \hline \end{array}}$$
Consider the following query:
Find the names of sailors with a higher rating than all sailors with age < 21.
Which one among these SQL queries attempt to obtain the answer to this question?
-
SELECT S.sname FROM Sailors S WHERE NOT EXISTS ( SELECT * FROM Sailors S2 WHERE S2.age < 21 AND S.rating <= S2.rating )
-
SELECT * FROM Sailors S WHERE S.rating > ANY ( SELECT S2.rating FROM Sailors S2 WHERE S2.age < 21 )
-
SELECT S.sname FROM Sailors S WHERE EXISTS ( SELECT * FROM Sailors S2 WHERE S2.age < 21 AND S.rating <= S2.rating )
-
SELECT S.sname FROM Sailors S WHERE S.rating >ALL ( SELECT S2.rating FROM Sailors S2 WHERE S2.age < 21 )