Determines whether a value is within a specified range, defined by a subquery, expression, or list.

Syntax

expression [ NOT ] IN ( compExpression [, compExpression ... ] )

Arguments

  • expression: the expression to evaluate.

  • compExpression: any valid expression which evaluates to a value which can be compared to expression.

Returns

  • The row or value, when the evaluation is true.

Additional Information

  • It is not necessary for the IN comparison expressions to appear in any particular order.

Examples

SELECT cust_id, saledate, amnt FROM MYSQL.inventory.cust_sales
WHERE saledate IN (DATE('2005-01-01'), DATE('2010-12-31'));

VALUES '2008' IN ('2010', '2000', '2008')
-- Returns true