Both are technically correct. However, there are reasons to avoid using between
as your teacher suggests. The simplest is that in English, the word is ambiguous and can include the end points or not. In fact, if you say that a point on a line is between two other points, the meaning is generally that the point does not coincide either end point.
This is a minor issue for integers. It becomes much more important with other data types. A particular issue is with date times. If you have a datetime field in the database, then the following does not work the way you expect:
where datetimefield between '2013-01-01' and '2013-01-02'
This will return all datetime values from 2013-01-01. Plus, it will return a datetime value that is at exactly midnight between the two dates. It will not return any other value from 2013-01-02.
I am heartened that your teacher recognizes the shortcomings of between
. I hope s/he also explains why the explicit comparison method is better.
EDIT:
By the way, something similar happens for strings as well. So:
where charfield between 'a' and 'b'
will return all values that start with 'a' and exactly 'b'. But not 'ba' or 'b1'. One way to write it is:
where charfield >= 'a' and charfield < 'c'
The point is. between
is a perfectly valid SQL construct. It works "correctly" for all data types. However, what is correct for SQL may not be intuitive for most people. Explicit comparisons come closer to avoiding this problem.