[ACCEPTED]-Does between in HQL compare strictly or not?-hql
Accepted answer
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
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;
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.