SubQuery

  • Primo Dang (3/8/2013)


    wolfkillj (3/8/2013)


    (...) The question and answers all come from this single short paragraph from BOL (...)

    You forgot the part about nesting limit - which, by the way, I don't find terribly important to know by heart whether it's 32, 64 or any other specific number. Does anyone actually push the limits of subquery nesting in real life systems?

    You're right - I should have said the question and the *actually correct* answers come from this paragraph.

    I think the only people who would push the limits of subquery nesting into the double-digit range are gluttons for punishment who like to hear users complain that the database is running slowly.

    Jason Wolfkill

  • I'm still waiting for someone to fix this. The answer saying "ORDER By is required when using a TOP clause" is clearly wrong.

  • buddy__a (3/8/2013)


    I'm still waiting for someone to fix this. The answer saying "ORDER By is required when using a TOP clause" is clearly wrong.

    It seems Steve isn't around. He will probably award points back and change the question text when he can.

  • mtassin (3/8/2013)


    SQLRNNR (3/7/2013)


    Looks like we may have a fun day with this question.

    Well.... probably.... I got it right... I noticed the backwardsness... but the other two were obviously wrong... always fun to use elimination to make sure you got it. πŸ™‚

    No they weren't. One of them (the 5th option) was obviously right.

    Tom

  • Primo Dang (3/8/2013)


    buddy__a (3/8/2013)


    I'm still waiting for someone to fix this. The answer saying "ORDER By is required when using a TOP clause" is clearly wrong.

    It seems Steve isn't around. He will probably award points back and change the question text when he can.

    Maybe not. He used to do that, but the last few bad questions he hasn't, even when he said he was going to (unless he did it since I last looked), awarded points back (although he did correct that question - although he didn't correct some worse ones).

    I'm inclined to think that not awarding points back may be a good thing, as it may reduce the amount of utterly cluesless "I want my point back" posts from people who haven't a clue. I don't like to see broken questions left unfixed, though.

    Tom

  • L' Eomot InversΓ© (3/8/2013)


    Primo Dang (3/8/2013)


    buddy__a (3/8/2013)


    I'm still waiting for someone to fix this. The answer saying "ORDER By is required when using a TOP clause" is clearly wrong.

    It seems Steve isn't around. He will probably award points back and change the question text when he can.

    Maybe not. He used to do that, but the last few bad questions he hasn't, even when he said he was going to (unless he did it since I last looked), awarded points back (although he did correct that question - although he didn't correct some worse ones).

    I'm inclined to think that not awarding points back may be a good thing, as it may reduce the amount of utterly cluesless "I want my point back" posts from people who haven't a clue. I don't like to see broken questions left unfixed, though.

    I agree. Question need to be fixed for future references. One point doesn't mean anything, let's not waste Steve time. πŸ™‚

    --------------------------------------------------------------------------------------
    Hai Ton
    My Db4Breakfast blog.

  • Hi all,

    The MSDN website that is referenced says: "may only include an ORDER BY clause when a TOP clause is also specified".

    To me that means the option "Must include an ORDER BY clause when a TOP clause is specified" is wrong and that "An ORDER BY is not required if a TOP clause is used" is right.

    Cheers.

  • db4breakfast (3/8/2013)The question did more good than harm.

    Only for people who came to the discussion thread.

    For anyone who just read the incorrect explanation, they'll have potentially picked up a new piece of information that is in fact wrong.

  • Lack of proper reading skills helped me get this question right. I thought options 3 and 5 were about allowing or not allowing ORDER BY withhout TOP on first reading. After checking the comments here I went back and reread, and found that I only got a point for this question because I messed it up. How cynical. πŸ˜‰

    As a side note - I personally hate TOP without ORDER BY so much that I would not mind if the product were changed to match this question instead of the other way around. πŸ˜‰


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Thanks for the question. It got us all thinking and complaining which isn't a totally bad thing.

  • Good one

  • Oops ....

    Lost my point...

    "Must include an ORDER BY clause when a TOP clause is specified"

    I think above option is wrong.

    Ex:

    select * from sys.objects where object_id in

    (select top 10 object_id from sys.objects)

    above statement working fine with out Order by clause.

  • After answering the question.. I thought, Dinesh u r great.. you are one among the 30%.. But after reading everyone's comments only i understood i'm in wrong side.

    --
    Dineshbabu
    Desire to learn new things..

  • "Must include an ORDER BY clause when a TOP clause is specified"

    I feel this statement is wrong.

    "Must include TOP clause when an order by is specified"

    this is correct.other wise will get exception message

    "Msg 1033, Level 15, State 1, Line 2

    The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified."

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • Good one.

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

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