Use the SOME keyword with comparison operators to permit a query to return a set of values rather than a single value.
= ¬= > >= < <= < >
The symbol ¬= is an alternative symbol for < > (not equal to). It is an ANSI SQL operator. (If you are using remote data access, the preferred symbol is < >.)
- When ALL is used, all values in the set returned satisfy the condition.
- When ANY or SOME is used, at least one value in the set returned satisfies the condition.
- IN can be used in a subquery in place of either of the following:
= SOME = ANY
SELECT NAME, ID FROM Q.STAFF WHERE DEPT = SOME (SELECT DEPTNUMB FROM Q.ORG WHERE DIVISION='EASTERN')
The keyword SOME is used in this query because there are multiple departments in the Eastern division. If ALL is used instead of SOME (or ANY), the result is an empty set. No employee works in all the departments of the Eastern division.