473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

between

Is there any chance on supporting BETWEEN in the WHERE conditions of a SELECT
clause?
Isn't that in the SQL92 or SQL3?

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
14 2455
> Is there any chance on supporting BETWEEN in the WHERE conditions of a SELECT
clause?


You mean like this?

Welcome to psql 7.4.1, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

Timing is on.
uscf=> select count(*) from memmast
uscf-> where memid between '10000000' and '19999999';
count
--------
514070
(1 row)

That's been in PostgreSQL for a long time.
--
Mike Nolan
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #2
El Vie 26 Dic 2003 13:02, Mike Nolan escribió:
Is there any chance on supporting BETWEEN in the WHERE conditions of a SELECT clause?


You mean like this?

Welcome to psql 7.4.1, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

Timing is on.
uscf=> select count(*) from memmast
uscf-> where memid between '10000000' and '19999999';
count
--------
514070
(1 row)

That's been in PostgreSQL for a long time.


Damn, didn't find it in the docs, and just supposed it wasn't there.

Well, shouldn't there be something writen especially in the SELECT manual?

http://www.postgresql.org/docs/curre...ql-select.html

Sorry for not checking it out before. :-(

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #3
Martin Marques <ma****@bugs.unl.edu.ar> writes:
That's been in PostgreSQL for a long time.
Damn, didn't find it in the docs, and just supposed it wasn't there.
It's been shown on the 'Comparison Operators' page for a long time:

http://www.postgresql.org/docs/7.1/s...omparison.html
Well, shouldn't there be something writen especially in the SELECT manual?


It'd be fairly unhelpful to try to mention every available operator on
SELECT's reference page, I would think.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #4
El Vie 26 Dic 2003 16:26, escribió:
Martin Marques <ma****@bugs.unl.edu.ar> writes:
That's been in PostgreSQL for a long time.

Damn, didn't find it in the docs, and just supposed it wasn't there.


It's been shown on the 'Comparison Operators' page for a long time:

http://www.postgresql.org/docs/7.1/s...omparison.html
Well, shouldn't there be something writen especially in the SELECT manual?


It'd be fairly unhelpful to try to mention every available operator on
SELECT's reference page, I would think.


A link to the URL above in the SELECT page?

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #5
> Damn, didn't find it in the docs, and just supposed it wasn't there.

Try finding it in the online mysql docs. :-)

Yes, it is there, but it took me far longer to wade through their
docs to find it than in the postgresql docs.

It took me less time with the Oracle SQL Language Reference Manual, but
I cheated by looking it up in the index. There are index entries for
'BETWEEN' in "Practical PosgreSQL" and "Managing & Using MySQL", too.

Sometimes books are still better than online docs. :-)
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #6
El Vie 26 Dic 2003 18:02, Mike Nolan escribió:
Damn, didn't find it in the docs, and just supposed it wasn't there.


Try finding it in the online mysql docs. :-)

Yes, it is there, but it took me far longer to wade through their
docs to find it than in the postgresql docs.

It took me less time with the Oracle SQL Language Reference Manual, but
I cheated by looking it up in the index. There are index entries for
'BETWEEN' in "Practical PosgreSQL" and "Managing & Using MySQL", too.

Sometimes books are still better than online docs. :-)


How dificult would it be to build an index from a SGML archive? :-)

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #7
Mike Nolan <no***@gw.tssi.com> writes:
It took me less time with the Oracle SQL Language Reference Manual, but
I cheated by looking it up in the index.


Just FYI, there's an index entry for BETWEEN in the PG docs too:
http://www.postgresql.org/docs/7.4/s...bookindex.html
although it seems to mistakenly be lowercase instead of uppercase
as one would expect.

In general though I agree that the indexing of the docs is pretty
weak. Perhaps someone would care to step up and submit docs patches
to improve the situation? Adding index entries is no sweat if you
have even a moderate acquaintance with SGML or HTML ... we just need
someone willing to go through the files and add suitable entries ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #8
El Vie 26 Dic 2003 18:27, Tom Lane escribió:
Mike Nolan <no***@gw.tssi.com> writes:
It took me less time with the Oracle SQL Language Reference Manual, but
I cheated by looking it up in the index.


Just FYI, there's an index entry for BETWEEN in the PG docs too:
http://www.postgresql.org/docs/7.4/s...bookindex.html


Once again, I was wrong. OK, bookmarked for the future. :-)

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #9
> Just FYI, there's an index entry for BETWEEN in the PG docs too:
http://www.postgresql.org/docs/7.4/s...bookindex.html
although it seems to mistakenly be lowercase instead of uppercase
as one would expect.
I think I tried searching on 'between' but didn't find anything.
In general though I agree that the indexing of the docs is pretty
weak. Perhaps someone would care to step up and submit docs patches
to improve the situation? Adding index entries is no sweat if you
have even a moderate acquaintance with SGML or HTML ... we just need
someone willing to go through the files and add suitable entries ...


I may look into it after the first of the year, though I'm likely to
propose something more sweeping than that.
--
Mike Nolan

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #10
>>>>> "Martin" == Martin Marques <ma****@bugs.unl.edu.ar> writes:

Martin> A link to the URL above in the SELECT page?

Uh, do you also want a link to "installing PostgreSQL" there too?
After all, you have to install Pg before you can use the SELECT
operator.

It's not any more related to SELECT than it is anything else. It's a
part of an expression. Expressions are used many places and described
one place. That's the nature of documentation.

Maybe I'm sounding grouchy, but at some point, you do the common sense
thing.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me****@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #11
El Vie 26 Dic 2003 20:10, Randal L. Schwartz escribió:
>> "Martin" == Martin Marques <ma****@bugs.unl.edu.ar> writes:

Martin> A link to the URL above in the SELECT page?

Uh, do you also want a link to "installing PostgreSQL" there too?
After all, you have to install Pg before you can use the SELECT
operator.


Please, don't get me wrong, I have read great part on the PG manuals already,
and have mad lots of Solaris instalation in times of the early PG 7.0, when
there was not much experience on this OS, and have been trying to make a 64
bit build on Linux/SPARC.

Do you think I would have been able to do this without reading "installing
PostgreSQL"? :-)
It's not any more related to SELECT than it is anything else. It's a
part of an expression. Expressions are used many places and described
one place. That's the nature of documentation.

Maybe I'm sounding grouchy, but at some point, you do the common sense
thing.


I personaly find this incomplete:

==================>CUT FROM THE SELECT MANUAL<===========================
WHERE Clause

The optional WHERE condition has the general form:

WHERE boolean_expr


boolean_expr can consist of any expression which evaluates to a Boolean value.
In many cases, this expression will be:

expr cond_op expr


or

log_op expr


where cond_op can be one of: =, <, <=, >, >= or <>, a conditional operator
like ALL, ANY, IN, LIKE, or a locally defined operator, and log_op can be one
of: AND, OR, NOT. SELECT will ignore all rows for which the WHERE condition
does not return TRUE.
==================>CUT FROM THE SELECT MANUAL<===========================

Now in this last paragraph there are some comparision operators. How awful
could it be to just add the word "BETWEEN" there? I know the BETWEEN sintax,
but as I didn't see it there I thought, wrongly, that it wasn't supported.

Maybe it's that I have the bad habit of just reading the "SQL Commands" while
I work, and having a very volatile memory. :-)

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #12
Martin Marques <ma****@bugs.unl.edu.ar> writes:
I personaly find this incomplete:
==================>CUT FROM THE SELECT MANUAL<===========================


So it is, but I think the solution is to eliminate the incomplete
examples. Which, indeed, seems to have been done in the 7.4 docs:
http://www.postgresql.org/docs/7.4/s...#QUERIES-WHERE
http://www.postgresql.org/docs/7.4/s...ql-select.html

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #13
Mike Nolan (Friday 26 December 2003 16:02)
Sometimes books are still better than online docs. :-)
No, the online docs simply need an index with links :-). If I could look at a
complete index and quickly find BETWEEN in the B's with links to applicable
sections, I would have no other wish of the already very good documentation.

Vertu sæll,

--
Sigþór Björn Jarðarson (Casey Allen Shobe)
cs****@softhome.net / http://rivyn.livejournal.com
Jabber: si*****@jabber.org; ICQ: 1494523; AIM/Yahoo: SomeLinuxGuy

Free development contributor of: KDE toolbar icons
Kopete user interface, usability, and testing
X11 Icelandic Dvorak keymaps
Reporting of over 100 Kopete bugs


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #14
Tom Lane (Friday 26 December 2003 16:27)
Just FYI, there's an index entry for BETWEEN in the PG docs too:
http://www.postgresql.org/docs/7.4/s...bookindex.html
although it seems to mistakenly be lowercase instead of uppercase
as one would expect.
Oh! There is an index now. Wonderful!
In general though I agree that the indexing of the docs is pretty
weak.
Yeah...not exactly what I'd call a *complete* index, but still better than
what I thought existed (no index).

*smacks self in forehead for previous post to mailing list complaining about
no index*
(http://199.72.170.146/~sigthor/images/humor/stupid.jpeg)

Vertu sæll,

--
Sigþór Björn Jarðarson (Casey Allen Shobe)
cs****@softhome.net / http://rivyn.livejournal.com
Jabber: si*****@jabber.org; ICQ: 1494523; AIM/Yahoo: SomeLinuxGuy

Free development contributor of: KDE toolbar icons
Kopete user interface, usability, and testing
X11 Icelandic Dvorak keymaps
Reporting of over 100 Kopete bugs


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
24
by: Nalla | last post by:
Hi, I want a program. It should be a command line one. you can input the path of a folder(preferably) or a file...it should count the no. of lines between the compiler directives, ifdef win32 and...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
14
by: Siv | last post by:
Hi, I just discovered that if in an ADO.NET query I use: "Select * from Invoices Where InvoiceDate BETWEEN StartDate AND EndDate;" In this case StartDate would be 1st of month and EndDate...
13
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
26
by: Gary Wessle | last post by:
Hi I need help to generate some random numbers between 2 and 8. #include <cstdlib> using std::rand; the following was out of my range, int main() {
4
by: DBC User | last post by:
This is a very simple question, I have a number and I want to check if the number is between 2 integers. I can use 'if' to resolve this situation. But I am curious, if there is any other verbs that...
8
lotus18
by: lotus18 | last post by:
Hello World! I know that The BETWEEN ... AND operator selects a range of data between two values and I found article about this operator that it is treated differently in different databases....
5
by: sara | last post by:
Hi - I have had this problem MANY times and I just don't think I have the best solution. I am running a parameter query to retrieve records where work was completed between 2 dates. The...
1
by: remya1000 | last post by:
I’m using VB.net 2003 application program. I am trying to do a select statement whereby I'm searching between 2 datetime values that are being stored as datetime. records are stored inside...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.