The Subquery

  • Very nice question. I could definitely see this happening in real world scenarios. I have to share this one with my coworkers. Nice job!

  • I agree - really good question. I originally didn't like that the difference in column names was so subtle, but after thinking about it for a bit I think it was a good idea. It demonstrates the behaviour of SQL Server, and, how easily a mistake could be made.

    Thanks

  • Nice one.....

  • Bit of a trick question, but nice nonetheless.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (5/13/2013)


    Bit of a trick question, but nice nonetheless.

    +1 Unfortunately, I didn't pick up on that until it was too late.



    Everything is awesome!

  • Good Trick Question.

    I don't really like SQl server when it works by Accident raher than Logic.

    David

  • nuh.. uh.. the 'correct' answer is wrong. This will produce a syntax error due to the misspelt column name in the subquery.

  • james.of.rivendell (5/16/2013)


    nuh.. uh.. the 'correct' answer is wrong. This will produce a syntax error due to the misspelt column name in the subquery.

    No it won't. Try running it yourself, and maybe even reading some of the other comments.

  • It was very tricky. I would have easily fallen for it had I not experienced the same issue in one of my system. Thanks for this cool quesion. 🙂

  • subtility !

  • timothys (5/9/2013)


    That was a great question. Especially the similarity of the column names to demonstrate how easily a typo can be overlooked and still return what you expect (since in this case the primary keys matched). A better example may have been to have the primary keys not match and the three rows are still returned. I think that would have caused some head scratching from some people.

    Jepp, great idea to complicate it. I guess it would be even more realistic and an example of our daily business...

    I really laughed when I found the result: I have to work on my concentration :w00t:

    ________________________________________________________
    If you set out to do something, something else must be done first.

Viewing 11 posts - 31 through 42 (of 42 total)

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