IN and NOT IN in SQL — a practical guide to SQL IN NOT IN with clear examples you can reuse in real projects.
SQL Tutorial Series (30/100). Prefer one article? Read the complete SQL tutorial.
Short description
Prefer JOIN/EXISTS over long NOT IN lists with NULLs — NULL handling can surprise you.
IN
SELECT * FROM products
WHERE category_id IN (1, 2, 5);