SQL TutorialLesson 23Free preview
SQL In
This lesson is part of SQL · All levels
Summary
The IN operator allows you to check whether a value matches one of the values in a list. IN makes the conditions more concise than writing many ORs. IN can also be combined with NOT to check for values that are not on the list.
Key points
- IN (v1, v2,...) is true if the value is equal to one of the lists.
- It's more concise and readable than the OR series.
- Can be used with subqueries, such as WHERE ID IN (SELECT...).
- NOT IN returns a line whose value is not on the list.
- Caution: NOT IN with a list containing NULL can result in empty results.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.