Skip to main content
SQL โ€ข LESSON 47

NOT IN

How can we exclude several values from our results?

Beginnerโฑ 3 Minutesโญ 600 XP
๐Ÿค” THE QUESTION

How can we exclude several values from our results?

๐Ÿ’ก WHAT IS IT?

NOT IN filters out records whose column values match any entry in a given exclusion set.

๐ŸŽฏ WHAT IS IT USED FOR?

Excluding specific departments, filtering out banned accounts, omitting inactive statuses.

๐Ÿ’ป EXAMPLE
SELECT name, department
FROM employees
WHERE department NOT IN ('HR', 'Finance');

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for NOT IN.

  • โœ“ NOT IN
  • โœ“ Exclusion lists
  • โœ“ Categorical exclusion
  • โœ“ WHERE conditions