Skip site navigation (1) Skip section navigation (2)

Re: BETWEEN clause

From: Joel Burton <jburton(at)scw(dot)org>
To: Paul Tomblin <ptomblin(at)xcski(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: BETWEEN clause
Date: 2001-04-24 04:07:41
Message-ID: Pine.LNX.4.21.0104240005450.4921-100000@olympus.scw.org (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-novice
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(at)scw(dot)org>
Director of Information Systems, Support Center of Washington


In response to

Responses

pgsql-novice by date

Next:From: will trillichDate: 2001-04-24 07:08:50
Subject: Re: Re: BETWEEN clause
Previous:From: Paul TomblinDate: 2001-04-24 02:54:05
Subject: BETWEEN clause

pgsql-general by date

Next:From: eric07Date: 2001-04-24 05:11:55
Subject: configure on a P4?
Previous:From: Paul TomblinDate: 2001-04-24 02:54:05
Subject: BETWEEN clause

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group