expression IN (value[,...])

Description: Returns 1 if expression is any of the values in the list of one or more values; 0 otherwise.

The comparison is done according to the datatype of expression. If a case-sensitive expression, the comparison is done in a case-sensitive way.

Examples:

  • 5 IN (43, 5, 12) returns 1.

  • 'a' IN ('A', 'B', 'C') returns 1.

  • BINARY 'a' IN ('A', 'B', 'C') returns 0.

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.