101 reputation
2
bio website alivate.com.au
location Geelong
age 28
visits member for 2 years, 4 months
seen Nov 13 '14 at 0:50

Software developer, working mainly in the .NET environment


Nov
10
awarded  Supporter
Nov
10
comment Why is SQL's BETWEEN inclusive rather than half-open?
The best answer should have referenced objective decision documentation from the people who first specified BETWEEN for SQL, thereby answering Why, rather than the subjective answer selected.
Nov
10
comment Why is SQL's BETWEEN inclusive rather than half-open?
@KevinKirkPatrick - Great answer! I suggest you also try to find the decision documentation as objective evidence of the original Why.
Nov
10
comment Why is SQL's BETWEEN inclusive rather than half-open?
One needs to consider all applications, not just English applications for Integer sets. "between 1 and 10", "between noon and 1pm", "between 1.0 and 5.0" (grams). "between 5.50 and 10.30" (dollars). Continuous quantities would be logically (Englishly) assumed to be exclusive.
Nov
10
comment Why is SQL's BETWEEN inclusive rather than half-open?
SQL is supposed to be English-like, and although inclusive and exclusive may be equally common, it's a query language for analysts and programmers. As a programmer, I think it's defined wrong, but that doesn't really matter, I just avoid using "BETWEEN" anyway. Not a big deal.
Nov
10
comment Why is SQL's BETWEEN inclusive rather than half-open?
"I think inclusive BETWEEN is more intuitive" is subjective. "SQL is occasionally used by non-programmers to make simple queries" - Non-programmers would equally need to check the spec.
Jan
17
comment Why is SQL's BETWEEN inclusive rather than half-open?
Your example focuses on integers, for decimal numbers and other delimited quantities (such as dates), the term between is ambiguous. If I say have you done X between 2012 and 2013, I don't include 2013 (or specifically the day 2013-01-01)
Jan
17
comment Why is SQL's BETWEEN inclusive rather than half-open?
I understand your frustration, (StartDate >= '2010-01-01' and StartDate < '2011-01-01'), works beautifully, to use Between the equivelent would be (StartDate between '2010-01-01' and '2010-12-31 23:59:59'), both bulky and one needs to know how many days are in Dec.
Jan
17
awarded  Autobiographer