Text Box: Set-Comparison Operators

 

 

 

  •  The set-comparison operators are IN, EXISTS and UNIQUE.  Also, NOT IN, NOT EXISTS and NOT UNIQUE are operators.
  • Also available:  op ANY, op ALL,  op IN
  • Find sailors whose rating is greater than that of some sailor called Horatio:
 
SELECT  *
FROM  Sailors S
WHERE  S.rating > ANY  (SELECT  S2.rating                         FROM  Sailors S2
                        WHERE S2.sname=‘Horatio’)