SQL — Between
Basic BETWEEN
SELECT * FROM employees
WHERE salary BETWEEN 40000 AND 60000;
NOT BETWEEN
SELECT * FROM employees
WHERE salary NOT BETWEEN 40000 AND 60000;
Dates
SELECT * FROM orders
WHERE order_date BETWEEN '2026-01-01' AND '2026-12-31';
Text
SELECT * FROM users
WHERE name BETWEEN 'A' AND 'M';
Mini Practice
Write SQL code that:
- Uses BETWEEN for numeric ranges
- Uses BETWEEN for date ranges
- Uses NOT BETWEEN
- Combines BETWEEN with other conditions
Up Next
In the next lesson, you'll learn about Union — combining query results.
Related Topics
Frequently Asked Questions about Between
What is Between in SQL?
Between is a fundamental concept in SQL. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Between?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Between.
Why is Between important in SQL?
Between is essential for SQL development. Understanding this concept will help you write better code and solve real-world problems more effectively.