Part 16: Range Filtering with BETWEEN and NOT BETWEEN

Part 16 Technology Updated September 12, 2026

Part 16: Range Filtering with BETWEEN and NOT BETWEEN

The BETWEEN operator filters values within a specified inclusive range.


1. Syntax

-- Inclusive range: includes 50000 and 80000
SELECT employee_id, salary
FROM employees
WHERE salary BETWEEN 50000 AND 80000;

Equivalent to: WHERE salary >= 50000 AND salary <= 80000;


2. Filtering Dates with BETWEEN

When filtering timestamps, BETWEEN '2024-01-01' AND '2024-01-31' excludes times on Jan 31st after 00:00:00 unless explicitly formatted!


Key Takeaways

  • BETWEEN is inclusive of both the lower and upper bounds.

In Part 17, we will explore List Filtering with IN and NOT IN!