SQL Server Interview Question #46
What is the BETWEEN operator?
SELECT, Filtering, Sorting & Built-in Functions Mid-Level Intermediate
Detailed Explanation
BETWEEN tests whether an expression falls within an inclusive range. Both boundary values are included.
For date/time filtering, BETWEEN can be risky when the upper boundary is intended to represent an entire day but the column also contains time. A half-open range such as >= start and < next day is often safer for DATETIME2 values.
Code Example
SELECT *
FROM dbo.Products
WHERE Price BETWEEN 100 AND 500;
SELECT *
FROM dbo.Orders
WHERE CreatedAt >= '2026-09-01'
AND CreatedAt < '2026-10-01';