SQL’s Between Range
We have previously found the minimum and maximum range for a price column in a table.
But what if we wanted to find the values in between? Say for example you wanted to view all the products you sell between $50 and $100 dollars?
SELECT * FROM products WHERE price BETWEEN 50 AND 100;
See how easy that is, it almost reads like a normal sentence, this is why SQL is considered to have natural language syntax.
Now, the between operator can also be used to find in a range of letters.
For example, if we have a table of employees and a column with employee last names, and we wanted to find all the employees whose last names range from a-m, we would do a query like this:
SELECT * FROM employees WHERE lastname BETWEEN a AND m;
Easy as pie.
No related posts
















I was trying to understand the difference with this versus using max and min.