[ACCEPTED]-Does between in HQL compare strictly or not?-hql

Accepted answer
Score: 57

I didn't find any specification of the behavior 4 in the Hibernate docs, but the between operator 3 in HQL is translated to the between operator in 2 SQL, which is inclusive.

So between in HQL is also 1 inclusive, that is

A between 5 and 10

is equivalent to

A >= 5 and A <= 10
Score: 4

obviously there is some confusion regarding 6 this. natural language would suggest it 5 is exclusive, but this is not true. in reality 4 its A >= 5 and A<=10. since there 3 were already contradicting answers given 2 (and delted), there needs to be more clarification: (from 1 http://www.techonthenet.com/sql/between.php)

Example #1 - Numbers

The following is an SQL statement that uses the BETWEEN function:

SELECT *
FROM suppliers
WHERE supplier_id between 5000 AND 5010;

This would return all rows where the supplier_id is between 5000 and 5010, inclusive. It is equivalent to the following SQL statement:

SELECT *
FROM suppliers
WHERE supplier_id >= 5000
AND supplier_id <= 5010;

More Related questions