Consider this table named easy_drinks
,
+------------------+
| drink_name |
+------------------+
| Kiss on the Lips |
| Hot Gold |
| Lone Tree |
| Greyhound |
| Indian Summer |
| Bull Frog |
| Soda and It |
| Blackthorn |
| Blue Moon |
| Oh My Gosh |
| Lime Fizz |
+------------------+
A query as such,
select drink_name from easy_drinks where drink_name BETWEEN 'G' and 'O';
results in
+------------------+
| drink_name |
+------------------+
| Kiss on the Lips |
| Hot Gold |
| Lone Tree |
| Greyhound |
| Indian Summer |
| Lime Fizz |
+------------------+
drink names starting with O
are not included in the result. But as per the manual page
expr BETWEEN min AND max
If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN returns 1, otherwise it returns 0. If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN >returns 1, otherwise it returns 0.
Why is the query giving such results?
I have been through questions that explain the behaviour for Timestamp and Date. What is the reason in this case?