Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BETWEEN


BETWEEN

Author
Message
Matt Miller (#4)
Matt Miller (#4)
SSCertifiable
SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)

Group: General Forum Members
Points: 7639 Visits: 18060
Comments posted to this topic are about the item BETWEEN

----------------------------------------------------------------------------------
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?
Vivien Xing
Vivien Xing
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1292 Visits: 2204
Good question. The detail-oriented person earns 1 point as reward. Smile
Simon Facer
Simon Facer
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1587 Visits: 724
Badly worded question -
Would statements #1 and #2 consistently return the same result set?
How do we define "Same Result" Same result as the other statement? Same result across multiple executions of each statement?

Obviously statement #2 will always return 0 - 5 is greater than 3. DUH. But if you rerun statement #1 (without rerunning the CREATE / INSERT statements), it will always return the same result; just as statement #2 will always return 0.

Sorry, didn't like that question at all. This reminds me of the old style MS certification questions - the answer is open to interpretation of the question.

At least I get a point for this post ...Tongue



dragos_sv
dragos_sv
SSC Eights!
SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)SSC Eights! (801 reputation)

Group: General Forum Members
Points: 801 Visits: 1017
my understanding was that subsequent runs of statement #1 and statement #2 would return the same result (over time)- which does, if the table is not cleared and the insert rerun.... not that the two results whould be equal to each other (i say it was quite obvious that the 2nd would return 0 )
oh well... Smile
rodjkidd
rodjkidd
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3646 Visits: 8029
I don't normally criticise the questions as:

a. This site is free
b. You don't win anything
c. You nearly always learn something even when the question is ambiguous!

But this one is really ambiguous for me as depending on how you read the question all three answers are true:

1. Create the table insert the data once.
Would statement one always return the same answer - Yes, would statement two always return the same answer - Yes

2. Same scenario, but would statement one AND statement two return the same answer - No (Which is the point of the question as beautifully explained!) OK maybe it's too early in the morning and my brain wasn't quite with it as it really couldn't be option 1, but…

3. You run the whole script every time (it was a temp table after all!) - Well as the data could change each time - Undetermined!

So I had a one in three chance (seeing as I nearly always pick the wrong one in a fifty/fifty - I had no chance with a 1 in 3!) of picking the right answer, which of course I didn't!

So c. rules again, as at least I had to think about this one!
And it reminded me of – if you are using parameter values in the where, i.e. BETWEEN @Param1 AND @param2.
Check first if the @Param1 is less than @Param2 (if not swap them round!)


Rodders...



ChiragNS
ChiragNS
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2409 Visits: 1865
Hi

question is rather poorly worded. I thought the question was whether running the statements repeatedly would produce different results.

"Keep Trying"
Philip Barry
Philip Barry
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1406 Visits: 646
I read the question as if multiple executions of the select statements would return the same result, so I unfortunately selected the incorrect answer.

I think that it would be better worded as:

"Would statements #1 and #2 consistently return identical result sets?"

What does everyone else think?

Regards,

Phil
Wilfred van Dijk
Wilfred van Dijk
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1025 Visits: 1352
statement 2 will always result the same result set: nothing
To my opinion, the answer is YES

The explanation was about a misused BETWEEN ... what a @#$!%!#

Wilfred
The best things in life are the simple things
ezlik3sundaymorning
ezlik3sundaymorning
SSC-Enthusiastic
SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)SSC-Enthusiastic (119 reputation)

Group: General Forum Members
Points: 119 Visits: 132
I have to say that I did not like this question either. If you only run the create and insert once you will consistently get the same results in each of the queries seperately. Re-running them multiple times as in a stored proc, would obviously produce results that would not be consistent with the exception of query 2, but not both.

Sorry, trick questions open to interpretation are bogus. What is my knowledge, I guess that is open to interpretation too.
marklegosz
marklegosz
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1114 Visits: 1171
The title of the question was 'BETWEEN' therefore it was obviously going to test your between knowledge. Stop complaining and get back to work.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search