in predicate
Returns true if elem equals any exprN or a row in query.
Syntax
elem in ( expr1 [, ...] )
elem in ( query )
Arguments
- 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 with- elem. If the query returns more than one column- elemmust be an tuple (STRUCT) with the same number of field
Returns
The results is a BOOLEAN.
Examples
SQL
> 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;