Data 360 SQL and Tableau Hyper API
Type Conversions
ALL
ANY and SOME
EXISTS
IN
NOT IN
Logical Operators
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
ANY / SOMEApplies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Tests whether a comparison between an expression and any row of a subquery is true. Returns a boolean result. SOME is a synonym for ANY.
1<expression> <operator> ANY ( <subquery> )
2<expression> <operator> SOME ( <subquery> )<expression>: The left-hand value to evaluate and compare against each row of the subquery result.<operator>: A comparison operator that returns a boolean result that’s applied between the left-hand expression and each subquery row.<subquery>: A parenthesized subquery that returns exactly one column.Returns true if the comparison yields true for any subquery row. Returns false if no true result is found, including when the subquery returns no rows.
Returns NULL if no comparison returns true and at least one right-hand row yields NULL for the operator’s result.
IN is equivalent to = ANY.Return rows whose value is greater than at least one value in the subquery result.
1SELECT col1
2FROM tab1
3WHERE col1 > ANY (SELECT col2 FROM tab2);When the subquery returns no rows, ANY returns false.
1SELECT 1 = ANY (SELECT col2 FROM tab2 WHERE 1 = 0) AS result;Returns false.
When no row matches and at least one row is NULL, the result is NULL rather than false.
1SELECT 1 = ANY (VALUES (2), (3), (NULL)) AS result;Returns NULL.
ANY/SOME array form that doesn’t involve a subquery.