T-SQL 2008

  • I also feels that answer is incorrect

    as cube and rollup are already there in sql server 2005

  • I agree with the others as well. I think the wording of this question was misleading as CUBE and ROLLUP both existed as keywords previously just not in the same context as in SQL 2008. A better way of asking the question might have been, "What are all of the ways that you can group a set of fields in the GROUP BY clause in SQL 2008?" Something along that line. GROUPING_ID still would not have been a valid answer though as you cannot use that syntax in the GROUP BY clause.

  • Grouping_ID is not a sub clause, but a function.

    Swarndeep

    http://talksql.blogspot.com

  • This is straight from the link supplied in the answer.

    SQL Server 2008 introduces several extensions to the GROUP BY clause that enable you to define multiple groupings in the same query. These extensions are: the GROUPING SETS, CUBE, and ROLLUP subclauses of the GROUP BY clause and the GROUPING_ID function. The new extensions are standard and should not be confused with the older, nonstandard CUBE and ROLLUP options.

    Even the answer points out that GROUPING_ID is a new function, not a subclause of the GROUP BY clause.

    Greg

  • G² (10/1/2009)


    This is straight from the link supplied in the answer.

    SQL Server 2008 introduces several extensions to the GROUP BY clause that enable you to define multiple groupings in the same query. These extensions are: the GROUPING SETS, CUBE, and ROLLUP subclauses of the GROUP BY clause and the GROUPING_ID function. The new extensions are standard and should not be confused with the older, nonstandard CUBE and ROLLUP options.

    Even the answer points out that GROUPING_ID is a new function, not a subclause of the GROUP BY clause.

    Greg

    You are exactly right. The question reads just like the documentation given and GROUPING_ID is a function not a subclause.

  • I am in the opinion of Grouping_ID is not a subclause of Group By. It is a function used in Select Statement for aggregation.

    I believe the answer is GROUPING SETS, CUBE, and ROLLUP.

    Dhans

  • G² (10/1/2009)


    This is straight from the link supplied in the answer.

    SQL Server 2008 introduces several extensions to the GROUP BY clause that enable you to define multiple groupings in the same query. These extensions are: the GROUPING SETS, CUBE, and ROLLUP subclauses of the GROUP BY clause and the GROUPING_ID function. The new extensions are standard and should not be confused with the older, nonstandard CUBE and ROLLUP options.

    Even the answer points out that GROUPING_ID is a new function, not a subclause of the GROUP BY clause.

    Greg

    I fully agree with your reasoning.

    Can't help the feeling that some QotDs are hurriedly researched and even more hurriedly worded--giving those who carefully weigh each word of the question, no chance at all to get it right.

    Whatever, aren't we used to receiving blurry requests and then have to go figure how to implement it so that the requestor receives exactly what he/she had in mind? 😎

    Michael

  • CUBE and ROLLUp are older than SQL 2008, Grouping_ID is a function and not a subclause of group by.

    Hence Grouping Sets is the only new feature introduced to GROUP BY by SQL 2008.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • G² (10/1/2009)


    This is straight from the link supplied in the answer.

    SQL Server 2008 introduces several extensions to the GROUP BY clause that enable you to define multiple groupings in the same query. These extensions are: the GROUPING SETS, CUBE, and ROLLUP subclauses of the GROUP BY clause and the GROUPING_ID function. The new extensions are standard and should not be confused with the older, nonstandard CUBE and ROLLUP options.

    Even the answer points out that GROUPING_ID is a new function, not a subclause of the GROUP BY clause.

    The question to me read

    SQL Server 2008 introduces several extensions (subclauses), to the GROUP BY clause. Select all those that apply.

    Was the question modified based on discussions here? If not, then I think based on the link the answer is correct. For CUBE & ROLLUP, the link says

    The new extensions are standard and should not be confused with the older, nonstandard CUBE and ROLLUP options

  • rjv_rnjn

    Was the question modified based on discussions here?

    No it was not ... the question was designed to bring attention to the subtle changes made between 2005 and 2008. Too many people fixated on the word (subclauses) and not enough paid attention to the word extensions, which is at the heart of the question.

    My favorite challenge to those who object is to ask them to compose a QOD and learn how difficult it is to satisfy everyone. Any one up to it?

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • It may have been the intention to design the question in that way, but nothing in the question shows its heart to be about extensions any more than it is about subclauses. Personally I feel the extensions relate to the subject of the sentence - the GROUP BY clause, and the whole is governed by the phrase "SQL Server 2008 introduces", which clearly excludes keywords introduced with 2005.

    Having said that, writing a QOD is difficult, and praise is due to all those who take the time to do so. The questions always help in some way, even if sometimes attention is drawn to the heart of the question for the wrong reason 🙂

  • david.wright-948385

    Having said that, writing a QOD is difficult, and praise is due to all those who take the time to do so. The questions always help in some way, even if sometimes attention is drawn to the heart of the question for the wrong reason

    Thank you ...

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • I would have to think the question if faulty in some way when close to 85% of the people answering it are getting it wrong.. IN my time here this is one of the most lopsided correct/incorrect percentage

  • Steve Vassallo

    would have to think the question if faulty in some way when close to 85% of the people answering it are getting it wrong

    Can not agree with you Steve. I try to make my questions difficult on somewhat obscure aspects of SQL server... sort of separates the men with deep knowledge of the subject from those wanna be's.

    In any case it gets them all to checking Books On Line, Technet, MSDN and maybe in doing so they learn a bit more -- which is the objective of the QOD. How many now realize that the CUBE and ROLLUP have changed since 2005 and a new function added?

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • This was removed by the editor as SPAM

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

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