Difficulty: Easy
Correct Answer: for ranges.
Explanation:
Introduction / Context:
When filtering data by a lower and upper bound, SQL provides a concise predicate to express inclusive range checks. Correct use makes queries more readable and reduces errors compared with chained comparisons.
Given Data / Assumptions:
Concept / Approach:
BETWEEN is an inclusive range predicate equivalent to: column >= lower AND column <= upper. It is commonly used for dates (for example, order_date BETWEEN '2025-01-01' AND '2025-01-31') or numbers. It does not limit selected columns (that is SELECT list control) and is unrelated to wildcards or joins.
Step-by-Step Solution:
Verification / Alternative check:
Compare results of WHERE x BETWEEN 10 AND 20 with WHERE x >= 10 AND x <= 20; they are equivalent.
Why Other Options Are Wrong:
Common Pitfalls:
Using BETWEEN for datetime boundaries without considering time components; prefer half-open intervals or cast/normalize to avoid off-by-one-day errors.
Final Answer:
for ranges.
Discussion & Comments