Re: Re: BETWEEN clause

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: BETWEEN clause
Date: 2001-04-24 07:08:50
Message-ID: 20010424020850.H27356@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

On Tue, Apr 24, 2001 at 12:07:41AM -0400, Joel Burton wrote:
> 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

just wanted to say -- BEAUTIFULLY executed reply.
not only did you answer the query succinctly and completely,
you showed, quite clearly, how to find out such answers.

"teach a man to fish..."

delightful!

--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2001-04-24 07:15:16 Re: Var substitution in SELECT statements
Previous Message Sami 2001-04-24 07:04:17 PostgreSQL - PHP insert deleted from database immediately?

Browse pgsql-novice by date

  From Date Subject
Next Message Paul Tomblin 2001-04-24 11:50:17 Re: Re: BETWEEN clause
Previous Message Joel Burton 2001-04-24 04:07:41 Re: BETWEEN clause