Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««34567»»

BETWEEN Expand / Collapse
Author
Message
Posted Wednesday, June 11, 2008 5:26 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:18 AM
Points: 23,229, Visits: 31,927
VALEK (6/11/2008)
Lynn Pettis (6/11/2008)
To paraphrase what someone else once said on this site, "The proof is in the code." Here is the code:

...
while @LoopCnt < 100
...

Based on the results, the answer is still NO.


Replace the code above wi th the following and comeback to me us the result (if you are still alive)

...
while @LoopCnt < 1000000000000000000000000000000000000000000000
...

Don't forget to write another script to analyse the result, since the output will be quite long.


It is in your court now. Sorry, but even if the two queries come back once with the same results, the answer is still NO. The reason is consistently return the same results. If BETWEEN 3 AND 5 was the same as BETWEEN 5 AND 3, the results of each run would have been consistant between the two queries.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #515592
Posted Wednesday, June 11, 2008 6:45 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, December 10, 2013 10:06 PM
Points: 374, Visits: 428

It is in your court now. Sorry, but even if the two queries come back once with the same results, the answer is still NO. The reason is consistently return the same results. If BETWEEN 3 AND 5 was the same as BETWEEN 5 AND 3, the results of each run would have been consistant between the two queries.


Don't forget the third option: NOT KNOWN.
We all know that the question was about BETWEEN, so why the hell did they use RAND() and some dodgy table?
I would phrase the question like this: do BETWEEN a AND b and BETWEEN b AND a in the WHERE clause have the same effect? YES/NO/UNKNOWN.

Let's put a fullstop on this. Everyone knows now the mechanics of BETWEEN and difference between BETWEEN a AND b and BETWEEN b AND a. The problem is that for me as a mathematician and a programmer, the original question contained redundant and confusing irrelevant information. Nevertheless I answered the question correctly since I guessed the purpose and ignored the dodgyness of the testbed. Though I decided to raise the conversation for the conversation sake so that everyone knows that not all questions comes clear to everyone as it does to the person asking the question. Thats all.

over


M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM
Post #515603
Posted Wednesday, June 11, 2008 8:58 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:33 AM
Points: 36,958, Visits: 31,465
... and that's why I hate multiple-guess questions... gimme a good solid essay question or lemme write some code, instead!

That was a fun conversation to watch... thanks, Gents. :)


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #515624
Posted Thursday, June 12, 2008 1:25 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 30, 2014 8:53 AM
Points: 1,049, Visits: 3,003
VALEK (6/11/2008)
Let's put a fullstop on this.


Several people tried to do that a couple of pages ago, but you still wanted the last word. It was on page 4 of this thread that Lynn first said "I think we're going to have to agree to disagree".

Everyone knows now the mechanics of BETWEEN and difference between BETWEEN a AND b and BETWEEN b AND a. The problem is that for me as a mathematician and a programmer, the original question contained redundant and confusing irrelevant information. Nevertheless I answered the question correctly since I guessed the purpose and ignored the dodgyness of the testbed. Though I decided to raise the conversation for the conversation sake so that everyone knows that not all questions comes clear to everyone as it does to the person asking the question. Thats all.

over


Is this still part of the "fullstop", or shall we call it a postscript? An appendix, perhaps?


Semper in excretia, sumus solum profundum variat
Post #515699
Posted Friday, June 13, 2008 2:13 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:09 AM
Points: 7,135, Visits: 15,148
Wow!~ my own mini religious war! I have to say I'm impressed with how riled up we've managed to get....

Anyway - like Steve has mentioned before - it might not be so easy as you think, so perhaps help bring up the quality of the questions by posting some of your own. Trying to ask something with a reasonable setup without necessarily shouting out the correct answer takes a bit of tuning, and I seem to have been a bit off-key on this one.

I do think there's no doubt it could have been worded more clearly, so I can take these comments to mind for any other questions I might put out there.

Anyway thanks! and I look forward to your collective contributions!


----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #517051
Posted Friday, June 13, 2008 2:32 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:18 AM
Points: 23,229, Visits: 31,927
Matt, I think to characterize this as a religious war is a little dramatic. I'd simply call it a strong difference of opinion.

As I said earlier, I'll agree to disagree. It was a good question, and I would not classify it as a trick question. It tested you ones knowledge of the BETWEEN clause as implemented in T-SQL.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #517060
Posted Friday, June 13, 2008 5:30 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:09 AM
Points: 7,135, Visits: 15,148
Oh fair enough Lynn. I just haven't been getting notified about posts, so coming back to find having ballooned out to 60 or so posts was astounding. But you're right - we're not talking NULLs handling or Identity fields, this is much milder....

Still amazing how "lively" the debate gets to be:)


----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #517109
Posted Thursday, July 10, 2008 7:07 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, October 22, 2012 8:55 AM
Points: 124, Visits: 180
Hmm.. Definitely open to interpretation.

"Would statements #1 and #2 consistently return the same result set?"

Yes, they would... Every time I run it, they consistently give me the same result set. The second one would just contain a zero.

Needs re-writing or removal, methinks.

Post #531559
Posted Monday, August 4, 2008 11:22 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, September 23, 2010 12:44 AM
Points: 63, Visits: 46
I'm with you on this one! The wording on the question was ambiguous and I interpreted it in a way that the writer did not intend...

Kristen Hodges
b. http://bi-tch.blogspot.com
Post #546515
Posted Tuesday, August 5, 2008 12:00 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:33 AM
Points: 36,958, Visits: 31,465
Lynn Pettis (6/13/2008)
I'd simply call it a strong difference of opinion.


Heh... isn't that the way religious wars get started. :P


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #546524
« Prev Topic | Next Topic »

Add to briefcase «««34567»»

Permissions Expand / Collapse