Hey.
Anything between single-quotes is considered a string, not a number. When you say
'500', MySQL reads that as three characters of text, but when you say
500, MySQL reads that as a single number.
The BETWEEN ... AND operators are meant to check if a value is in between a range of numbers (dates are also considered numbers internally). Trying to use it on strings will not work properly.
I was storing integer values like 5000 and 10000 in a column which was defined as varchar.
This is a big mistake, by the way. A huge waste of space. - When you store an integer as a VARCHAR, the storage requirements for each letter in the number is equal to the total storage requirements if it were stored as an INT.
And that's not to mention the headaces it will give you when you try to actually use it as a number (as you have discovered).