Skip to main content
SQL โ€ข LESSON 07

IN and BETWEEN

How can we check membership in a list of values or a continuous range?

Intermediateโฑ 2 Minutesโญ 140 XP
๐Ÿค” THE QUESTION

How can we check membership in a list of values or a continuous range?

๐Ÿ’ก WHAT IS IT?

IN checks for inclusion in a list, and BETWEEN filters for values within an inclusive range.

๐ŸŽฏ WHAT IS IT USED FOR?

Categorical filtering (departments, countries) and range filtering (salary brackets, date windows).

๐Ÿ’ป EXAMPLE
SELECT *
FROM employees
WHERE department IN ('IT', 'HR')
AND salary BETWEEN 40000 AND 80000;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for IN and BETWEEN.

  • โœ“ IN operator
  • โœ“ BETWEEN operator
  • โœ“ List matching
  • โœ“ Range queries