BETWEEN

  • I think people are making too much of the question. The real point of it wasn't the data used in the question but the BETWEEN clause itself. The question was good, the problem is how different people interpreted what was being asked in the question.

    😎

  • Lynn Pettis (6/9/2008)


    I think people are making too much of the question. The real point of it wasn't the data used in the question but the BETWEEN clause itself. The question was good, the problem is how different people interpreted what was being asked in the question.

    😎

    But agree with us -- the people here are not figures of art, blurry sciences or any other fluff. We are IT specialists with precise understanding of question and possible answers with one EXCACTLY answering the quesion.

    The questions should test knowledge, but not creative interpretation of the language.

    How would you treat the question of this sort?

    - 2x2 makes?

    a. three and a half

    b. around and/or possibly four

    c. less than 5

    the correct answer is c.

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • Sorry, I can't agree with you.

    One, I understood the question and what it was asking and therefore answered it correctly.

    Two, I've been in IT long enough to know this is not an exact science. I have worked with too many users with too many moving targets as requirements to think otherwise. We have to interpret what people are requesting because many times they themselves don't know either. You see it a lot right here in many of the posts asking for help.

    😎

  • Lynn Pettis (6/9/2008)


    Sorry, I can't agree with you.

    One, I understood the question and what it was asking and therefore answered it correctly.

    Two, I've been in IT long enough to know this is not an exact science. I have worked with too many users with too many moving targets as requirements to think otherwise. We have to interpret what people are requesting because many times they themselves don't know either. You see it a lot right here in many of the posts asking for help.

    😎

    True, but in this case noone is asking for help. There is a simple multiple guess question (the concept of it), which should be formulated as simple and clear as possible, and what's more important -- the answers should be as clear as crystal, and the correct one -- as correct as it could be.

    My high maths teacher would kill me for assigning 0.8^250000 to zero.

    And please agree -- RDB is an exact science, at least in its principle, I've seen many dodgy code in my life, and also many TSQL pieces relying on hardcoded values, chance that the error will not happen, statictics, and other unreliable stuff. The question in subject is one of those.

    About customers -- I totally agree.

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • And please agree -- RDB is an exact science, at least in its principle, I've seen many dodgy code in my life, and also many TSQL pieces relying on hardcoded values, chance that the error will not happen, statictics, and other unreliable stuff. The question in subject is one of those.

    Sorry, but you can't convince me to agree. I can't help it if you failed to interpret the question correctly. As I stated, the question was not about the data provided, it was about the use of the BETWEEN clause and how SQL interprets its use verses the common language/mathematics definition. This is just going to have to be one of those times where people are just going to have to agree to disagree.

    😎

  • VALEK (6/9/2008)


    My high maths teacher would kill me for assigning 0.8^250000 to zero.

    The question did not ask you to assign it to 0. The reason the word "consistently" is in the question is because the author of the question realized that there is the possibility that eventually the data produced would produce a set of 250000 rows that does not include any rows with values of 3, 4, or 5.

  • The question did not ask you to assign it to 0. The reason the word "consistently" is in the question is because the author of the question realized that there is the possibility that eventually the data produced would produce a set of 250000 rows that does not include any rows with values of 3, 4, or 5.

    Okay! You did not convince me either.

    Then please answer my question "Why on earth did theyt decide the use RAND() for the purpose of calculating the number of certain results generated by it using BETWEEN?"

    Now answer my survey:

    Q: There is a table of 250000 records called CUSTOMER with a field AGE. The information in the field AGE is random.

    Will

    SELECT COUNT(*) FROM CUSTOMER WHERE AGE BETWEEN 110 AND 111

    return the same result as

    SELECT COUNT(*) FROM CUSTOMER WHERE AGE BETWEEN 111 AND 110

    ?

    A1: YES

    A2: NO

    A3: UNKNOWN?

    answer (written upsidedown): A3

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • VALEK (6/10/2008)


    The question did not ask you to assign it to 0. The reason the word "consistently" is in the question is because the author of the question realized that there is the possibility that eventually the data produced would produce a set of 250000 rows that does not include any rows with values of 3, 4, or 5.

    Okay! You did not convince me either.

    Then please answer my question "Why on earth did theyt decide the use RAND() for the purpose of calculating the number of certain results generated by it using BETWEEN?"

    Now answer my survey:

    Q: There is a table of 250000 records called CUSTOMER with a field AGE. The information in the field AGE is random.

    Will

    SELECT COUNT(*) FROM CUSTOMER WHERE AGE BETWEEN 110 AND 111

    return the same result as

    SELECT COUNT(*) FROM CUSTOMER WHERE AGE BETWEEN 111 AND 110

    ?

    A1: YES

    A2: NO

    A3: UNKNOWN?

    answer (written upsidedown): A3

    Actually, the answer is A2, NO. Reason. There MAY BE a customer whose AGE is 110 or 111. The first query will catch that as the value of AGE could be GREATER THAN OR EQUAL TO 110 AND LESS THAN OR EQUAL TO 111. There are NO VALUES that would be GREATER THAN OR EQUAL TO 111 and LESS THAN OR EQUAL TO 110. That is the definition of BETWEEN in T-SQL.

    Believe what you want, but you still won't convince me.

    😎

  • Heh... No matter what, I'm happy I don't have to earn a living by taking Matt's tests 😛 They are thought provoking to say the least...

    --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.
    "Change is inevitable... change for the better is not".

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)
    Intro to Tally Tables and Functions

  • Actually, the answer is A2, NO. Reason. There MAY BE a customer whose AGE is 110 or 111. The first query will catch that as the value of AGE could be GREATER THAN OR EQUAL TO 110 AND LESS THAN OR EQUAL TO 111. There are NO VALUES that would be GREATER THAN OR EQUAL TO 111 and LESS THAN OR EQUAL TO 110. That is the definition of BETWEEN in T-SQL.

    Believe what you want, but you still won't convince me.

    😎

    the answer is UNKNOWN since the result returned by the two statements depend on the data in the tables, which is random.

    The fact that the second query always returns zero simplifies the task, but does not imply that the first one will return a different result to zero.

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • OKAY similar test.

    Q: Will the statement

    SELECT 12345 AS AGE

    return the same result as

    SELECT TOP 1 Age FROM CUSTOMERS

    ?

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • Not even similiar. Let me know when you decide to give up trying to convince me otherwise.

    😎

  • Lynn Pettis (6/10/2008)


    Not even similiar. Let me know when you decide to give up trying to convince me otherwise.

    😎

    Quite similar.

    One query returns a constant and the other returns a random figure.

    Q: Is the result same after the execution? A: unknown (even though there should not be anyone in CUSTOMERS aged 12345 years, but there is a slim possibility that the first AGE will be 12345)

    sp: remember the million monkeys vs typing machines trying to get Romeo&Juliet typed?

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

  • One query is returning a constant, the other a value from a table.

    Where is the simularity between the queries?

    Give it up. Neither of us is going to change the others minds on this.

    😎

  • Where is the simularity between the queries?

    Both return a single value (or an empty set).

    Give it up. Neither of us is going to change the others minds on this.

    Not really. We WILL change it and we already HAVE! I am sure that the ones reading the thread see how it is possible to confuse an obvious.

    ps: I answered the original question correctly FYI, but I just wasnot happy with the way the question was asked and the tools used to generate a testbed. QA engineers and Professional Software Testers will know what I am talking about.

    M.Sc.IT, M.B.A, MCTS BI 2008, MCITP BI 2008, MCTS SQL Dev, CSM, CDVDM

Viewing 15 posts - 31 through 45 (of 62 total)

You must be logged in to reply to this topic. Login to reply