Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns true
if elem
equals any exprN
or a row in query
.
elem in ( expr1 [, ...] )
elem in ( query )
elem
: An expression of any comparable type.exprN
: An expression of any type sharing a least common type with all other arguments.query
: Any query. The result must share a least common type withelem
. If the query returns more than one columnelem
must be an tuple (STRUCT) with the same number of field
The results is a BOOLEAN.
> SELECT 1 in(1, 2, 3);
true
> SELECT 1 in(2, 3, 4);
false
> SELECT (1, 2) IN ((1, 2), (2, 3));
true
> SELECT named_struct('a', 1, 'b', 2) in(named_struct('a', 1, 'b', 1), named_struct('a', 1, 'b', 3));
false
> SELECT named_struct('a', 1, 'b', 2) in(named_struct('a', 1, 'b', 2), named_struct('a', 1, 'b', 3));
true
> SELECT 1 IN (SELECT * FROM VALUES(1), (2));
true;
> SELECT (1, 2) IN (SELECT c1, c2 FROM VALUES(1, 2), (3, 4) AS T(c1, c2));
true;