Re: BETWEEN clause - Mailing list pgsql-general

From Joel Burton
Subject Re: BETWEEN clause
Date
Msg-id Pine.LNX.4.21.0104240005450.4921-100000@olympus.scw.org
Whole thread Raw
In response to BETWEEN clause  (Paul Tomblin <ptomblin@xcski.com>)
Responses Re: Re: BETWEEN clause  (will trillich <will@serensoft.com>)
List pgsql-general
On Mon, 23 Apr 2001, Paul Tomblin wrote:

> Is the "BETWEEN" clause inclusive or exclusive?  ie if I say "WHERE
> latitude BETWEEN 45 and 55", will I get examples where the latitude equals
> 45 or not?  Also, is "latitude BETWEEN 45 and 55" any more efficient than
> "latitude >= 45 AND latitude <= 55", or is it just a stylistic thing?

yes, yes, and no:


select 'exclusive' where 2 between 1 and 3;
 ?column?
----------
 inclusive

test=# select 'inclusive' where 1 between 1 and 3;
 ?column?
----------
 inclusive

test=# create view its_really_the_same_thing as select true where 1
between 1 and 3;

test=# \d its_really_the_same_thing
...
View definition: SELECT 't'::bool WHERE ((1 >= 1) AND (1 <= 3));


HTH,
--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-general by date:

Previous
From: Paul Tomblin
Date:
Subject: BETWEEN clause
Next
From: "Jeff Duffy"
Date:
Subject: Re: installing DBD::Pg without installing postgres