Thread: BETWEEN
Why is BETWEEN inclusive? I had assumed that it was like the english between, which is exclusive. playpen=# create table numbs ( a int); CREATE playpen=# insert into numbs values(1); INSERT 35913 1 playpen=# insert into numbs values(2); INSERT 35914 1 playpen=# insert into numbs values(3); INSERT 35915 1 playpen=# insert into numbs values(4); INSERT 35916 1 playpen=# insert into numbs values(5); INSERT 35917 1 playpen=# insert into numbs values(6); INSERT 35918 1 playpen=# insert into numbs values(7); INSERT 35919 1 playpen=# select * from numbs where a between 3 and 6;a ---3456 (4 rows)
Joseph Shraibman <jks@selectacast.net> writes: > Why is BETWEEN inclusive? Because the SQL92 spec says so: 6) "X BETWEEN Y AND Z" is equivalent to "X>=Y AND X<=Z". > I had assumed that it was like the english > between, which is exclusive. That's debatable... regards, tom lane