When a subquery returns several values, the equality operator alone cannot compare a column with all of them. ANY lets a comparison succeed when it matches at least one value returned by the subquery. section 11.2 section 11.2.1
Find titles from order 1034
SELECT t.TitleName FROM title t WHERE TitleID = ANY ( SELECT TitleID FROM orderitem WHERE OrderID = 1034 ); Read this as: return title names whose TitleID matches any TitleID belonging to order 1034. The query returns the four titles in that order. section 11.2.1
ANY works with comparison operators such as =, >, >=, <, and <=. For equality-only matching, IN usually expresses the same intent more commonly: TitleID IN (subquery). Use ANY when the comparison itself matters. section 11.2.1
Do not use <> ANY to mean “matches none.” With several subquery values, almost every value differs from at least one result, so the condition can return every title. Use ALL for the corresponding comparison, or use NOT IN for equality-based exclusion. section 11.2.2
SOME is supported by many relational database systems as an alternative name for ANY. Subqueries can require additional processing and memory, so consider whether another query shape is necessary. section 11.2.1 section 11.2.2
