Suggest an editImprove this articleRefine the answer for “What does the IN operator do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)`IN` is an operator that checks whether a value is in a list of possible options; used inside `WHERE` to avoid writing long chains of `OR`, e.g. `WHERE city IN ('Kyiv', 'Lviv', 'Odesa');`. **Key point:** with `NOT` it becomes a check for "the value isn't in the list", and instead of a fixed list you can use a subquery's result, e.g. `WHERE id IN (SELECT employee_id FROM bonuses);`.Shown above the full answer for quick recall.Answer (EN)Image`IN` is an operator that checks whether a value is in a **list of possible options**. It's used inside `WHERE`, to avoid writing long chains of `OR`. ### How it works `IN` compares a column's value against a set of values listed in parentheses. If the value matches at least one element from the list, the condition is true. ```sql SELECT * FROM employees WHERE city IN ('Kyiv', 'Lviv', 'Odesa'); ``` The query selects every employee whose city is Kyiv, Lviv, or Odesa. ### The alternative without `IN` Without it, you'd have to write it out long-form: ```sql WHERE city = 'Kyiv' OR city = 'Lviv' OR city = 'Odesa' ``` `IN` does the same thing, but shorter and clearer. ### Negation Adding `NOT` gives you a check for "the value **isn't** in the list": ```sql WHERE department NOT IN ('HR', 'Finance'); ``` This excludes everyone from the HR and Finance departments. ### A subquery can be used too ```sql WHERE id IN (SELECT employee_id FROM bonuses); ``` Selects every employee whose ID appears in the `bonuses` table. **Summary:** `IN` is a convenient way to filter against a whole set of values at once. It works with numbers, text, and even the results of subqueries.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.