By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,501 Members | 831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,501 IT Pros & Developers. It's quick & easy.

>,<,= or BETWEEN

P: n/a
What is the real difference between:

1. SELECT something1 FROM something2 WHERE Value >= 1 AND Value <= 1000

2. SELECT something1 FROM something2 WHERE Value BETWEEN 1 AND 1000

In what way 2. is better than 1.?

Thanks in advance

Marek Kotowski
Warsaw
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Marek Kotowski" <Ma************@wsip.com.pl> wrote in message
news:e5**************************@posting.google.c om...
What is the real difference between:

1. SELECT something1 FROM something2 WHERE Value >= 1 AND Value <= 1000

2. SELECT something1 FROM something2 WHERE Value BETWEEN 1 AND 1000

In what way 2. is better than 1.?


Less typing (usually).
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #2

P: n/a
I found that when you use BETWEEN it doesn't matter which of the two values
is first and which is second.
BETWEEN 1 AND 100 gives the same result as
BETWEEN 100 AND 1

(I tested this with dates, I think it would be the same for other data
types.)

Don't know which code runs faster.
If you have a large table to test on, you might find a difference.
If your table doesn't show a difference, then - both ways are fast!

Bruce Pick

"Marek Kotowski" <Ma************@wsip.com.pl> wrote in message
news:e5**************************@posting.google.c om...
What is the real difference between:

1. SELECT something1 FROM something2 WHERE Value >= 1 AND Value <= 1000

2. SELECT something1 FROM something2 WHERE Value BETWEEN 1 AND 1000

In what way 2. is better than 1.?

Thanks in advance

Marek Kotowski
Warsaw

Nov 12 '05 #3

P: n/a
"Bruce Pick" <br********@comcast.net> wrote in message news:<9P********************@comcast.com>...
I found that when you use BETWEEN it doesn't matter which of the two values
is first and which is second.
BETWEEN 1 AND 100 gives the same result as
BETWEEN 100 AND 1

(I tested this with dates, I think it would be the same for other data
types.)


In MySQL it doesn't work (with dates).

Marek Kotowski
Warsaw
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.