Accessing and changing data 2008

  • Tell me otherwise, bitbucket, but I think that you have read something into the BOL article that isn't there. Nothing says that sales is any kind of non-integer datatype - just as nothing says it isn't (in fairness). Plus, unfortunately, your use of the dictionary to justify your position is just plain confusing. I commend the fact that you have introduced me to a new part of SQL, and sparked some debate and interest, but...

  • ... given that in the BOL article "The following statements are equivalent" suggests that in the author of the article's mind, sales is NOT a floating point data type. Otherwise, surely, the quote would be "The following statements are NOT equivalent".

  • I'm confused as well. The question asked if the queries were the same, not if the result sets were the same. According to the link you supplied, the queries are the same. There's not enough information to determine if the result sets would be the same.

    I'm not sure from your post if your suggesting that "the same" is not the same as "equivalent" or if "equivalent" is not equivalent to "the same", but I think most of us will agree that they are synonyms in this context. Either way, now were discussing semantics not SQL. Just my opinion...

    Greg

  • Great Question. I got it right but for the wrong reason. After the explanation I see most people's point about the same not being the same.

    I always thought that 1 + 2 = 3, and that 2 + 1 = 3, so they are equivalent right? Does 1 + 2 = 2 + 1? Or are the so different as to make one wonder?

    Miles...

    Not all gray hairs are Dinosaurs!

  • Miles Neale (9/23/2008)


    Great Question. I got it right but for the wrong reason. After the explanation I see most people's point about the same not being the same.

    I always thought that 1 + 2 = 3, and that 2 + 1 = 3, so they are equivalent right? Does 1 + 2 = 2 + 1? Or are the so different as to make one wonder?

    Looked at as simple text, Query 1 (using GROUPING SETS) is not the same as Query 2 (using UNION ALL), in the same way that "1+2" is not the same as "2+1".

    However, most people would assume that the QoTD was asking more than a simple text comparison, i.e. is query 1 equivalent to query 2?

    The reference given says it is, since the queries given there are exactly as in the question! Hence the answer stated is wrong!

    Derek

  • Due is a tricky question I think both answers could be correct.

    And I want my points back!:w00t:

  • Miles Neale (9/23/2008)


    Great Question. I got it right but for the wrong reason. After the explanation I see most people's point about the same not being the same.

    I always thought that 1 + 2 = 3, and that 2 + 1 = 3, so they are equivalent right? Does 1 + 2 = 2 + 1? Or are the so different as to make one wonder?

    Miles...

    Right!..

    In a few words: The result is THE SAME, and the procedure is EQUIVALENT.

  • The question states "is the same as" and the term "equivalent" used in the explanation are essentially equal in meaning. They could be substituted and are generally considered equal in meaning and application. That being said, of course, I wanted the point!

  • This question is an exact copy and paste for BOL (ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_1devconc/html/136b4545-fd48-412f-8163-fadc3a235d36.htm). And according to BOL, the 2 statements are the same.....

  • I AGREE! If the person who wrote the question is going to copy the example from BOL, you can AT LEAST get the answer right!!

  • I just tested both queries in a copy of 2008 Enterprise, and the only difference in the results was the order (which, by RDBMS definition, doesn't matter).

    Here's my test:

    create table #T (

    Customer varchar(10),

    Year int,

    Sales money);

    insert into #T (Customer, Year, Sales)

    values ('Joe', 2007, 10),('Joe', 2008, 15),('Bob', 2008, 5);

    SELECT customer, year, SUM(sales)

    FROM #T

    GROUP BY GROUPING SETS ((customer), (year));

    SELECT customer, NULL as year, SUM(sales)

    FROM #T

    GROUP BY customer

    UNION ALL

    SELECT NULL as customer, year, SUM(sales)

    FROM #T

    GROUP BY year;

    I know others have already objected on this one, but I decided to post anyway.

    I have to disagree with the answer given, based on actual tests. I also tested it with the same test, using float instead of money for the sales data type, and still got the same results from both queries.

    I think the person who wrote the question mistook the difference between "is the code the same" and "are floating point operations deterministic".

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • bitbucket (9/23/2008)


    I would like to thank all who have commented. I have learned a little more to apply to any additional QOD that I may submit. Please note that I relied on the

    Merriam-Webster Dictionary definition for the words equivalent, and same which are:

    Equivalent:

    equal in force, amount, or value

    Same:

    equal in size, shape, value, or importance —usually used with the or a demonstrative (as that, those) in all senses

    The main objective as I understand the QOD is to introduce readers to new and/or little known aspects of SQL Server it is my hope that this is what this question did.

    Since when is QotD about English (grammar/syntax/meaning/whatever it's called)? Not everyone here have English as their native tongue. I'd like to think this site is a worldwide community, not just English community. Guess I'm wrong? :ermm:


    Urbis, an urban transformation company

  • HanShi (9/23/2008)


    bitbucket (9/23/2008)


    I would like to thank all who have commented. I have learned a little more to apply to any additional QOD that I may submit. Please note that I relied on the

    Merriam-Webster Dictionary definition for the words equivalent, and same which are:

    Equivalent:

    equal in force, amount, or value

    Same:

    equal in size, shape, value, or importance —usually used with the or a demonstrative (as that, those) in all senses

    The main objective as I understand the QOD is to introduce readers to new and/or little known aspects of SQL Server it is my hope that this is what this question did.

    As a non-native english speaker I'm unaware of such small differences between the meaning of words.

    For me: Same == Equivalent :ermm:

    But you are right about touching new aspects of SQL Server...

    Tricky question. As per English Same and Equivalent are synonyms. But agree with you for tauching a new concept of SQLserver.

  • Iggy (9/23/2008)


    Since when is QotD about English (grammar/syntax/meaning/whatever it's called)? Not everyone here have English as their native tongue. I'd like to think this site is a worldwide community, not just English community. Guess I'm wrong? :ermm:

    I can sympathize, but for me, having English as my first (only) language was not an advantage. 🙂

  • Don't worry about the English-language aspect of the question. By the definition being used to justify the answer on this one, neither query is equivalent to itself, since floating point operations are not guaranteed to give identical results in any circumstances.

    Thus, the first query isn't equivalent to itself, and the second query isn't equivalent to itself, and neither is equivalent to the other. At least, per the post justifying the negative answer.

    Personally, I disagree with that, but that's obviously the intent here.

    The question was on a good subject. I wasn't aware of that feature of 2008. Neat, potentially powerful feature. I can think of plenty of uses for it in reporting. But I do disagree with the answer and the justification for the answer.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 16 through 30 (of 49 total)

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