Why this two expressions return different results? This is really stupid.
SELECT * FROM Table WHERE ID BETWEEN 3 AND 1
SELECT * FROM Table WHERE ID BETWEEN 1 AN
ID BETWEEN 3 AND 1
is simply short hand for ID >= 3 AND ID <=1
so will never return any results.
If you look at the query plan you will see that the query text actually gets expanded out to this (Edit Or at least you can see this substitution of BETWEEN
with >=
/ <=
in queries that get auto parametrised)