CHOOSE - 1

  • As someone who definitely tries to run through the question in my mind, and not against an actual database, I also agree that it would have been helpful if the question included the table data as well.

  • Koen Verbeeck (1/28/2013)


    Apparently, there are 4 winter months? 🙂

    Anyway, I don't have AdventureWorks 2012 installed on this machine, so I had to guess. Quite a pity, because the idea of the question was good.

    However, if you try to answer the question within ten minutes of getting out of bed, you don't even notice that there are four months for Winter - at least I didn't. I wrongly assumed three for each, as my browser window was small and the end of the code line went off the page.

    Then I just assumed an even distribution of employee hire dates. Understanding how CHOOSE works, I then correctly answered a question that wasn't asked.:hehe:

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • I kept looking for a trick... something that wouldn't depend on the data itself that wasn't presented.

  • Ridiculous question as you have to know the content of a table in AdventureWorks 2012 to get the answer correct.



    Ole Kristian VelstadbrĂĄten BangĂĄs - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

  • Hugo Kornelis (1/28/2013)


    Tough I applaud the effort to create questions on new SQL2012 functionality, I really see nothing positive about this question.

    ...

    This question would have been so much better if it had been based on a much lower number of rows that were included in the question (so that you could just count the results by hand). Lost opportunity - too bad!

    +1

  • Hugo Kornelis (1/28/2013)


    This question would have been so much better if it had been based on a much lower number of rows that were included in the question (so that you could just count the results by hand). Lost opportunity - too bad!

    +1

    NB If you don't have SQL Server 2012 you don't have the choice of using CHOOSE, and if you're still on SQL Server 2005 you don't even have the DATE data type.

    Which months belong to which season depends on where you live. Also, the accepted start and end dates are not usually at the start or end of a month. For example, this year in the northern hemisphere (astronomical) spring starts on 20/03/13. It always feels to me like summer is the shortest season, usually a couple of weeks in July and a long weekend in August if you're lucky. But then I do live in the UK.

  • Hugo Kornelis (1/28/2013)


    Tough I applaud the effort to create questions on new SQL2012 functionality, I really see nothing positive about this question.

    Absolutely. QotD gets quite a mixed bag of good & poor questions, the poor ones due to the usual; ambiguities, poor phrasiology etc. However, if I were to vote on the worst QotD ever, this one would get it.

    I know it's not everyone's "thing" but my choice is to always select my answer without running any queries or reading any material first - if I get it wrong or have to guess, then that's the pompt to go reading and/or experimenting. The only way you could answer this question in that way is to have AW2012 Employee table committed to memory.

    Ridiculous.

  • I too do do not run queries when answering questions...

  • Good attempt at a question. Next time it would help to include the dataset or sql to insert data into the table. This was a question of what you own vs what you know.

  • raulggonzalez (1/28/2013)


    I don't see what this QotD is trying to test... It's not about how CHOOSE works but what data you have in a table that is not represented on the question itself...

    how can anybody come up with the right answer without executing the query (against the right db)??

    +1

    I chose Winter as largest because it had the most months (correct). I chose Spring because it had the fewest months (wrong). Without the actual data and then doing a count of how many reside in the months you are simply guessing and logically or statistically the answers are wrong.

    Badly designed question but on the right track with new functionality. I think CHOOSE is an interesting function.

  • Nice question, but without the data table the only way of finding the correct answer is to run the query against the AdventureWorks database. Personally, I prefer solving QotD without having to run queries and without having to use a certain demo database.

  • If a starter like me can realize the inherent drawback in this question (need dataset), I guess its not a good question for Qotd

    ___________________________________________________________________
    If I can answer a question then anyone can answer it..trying to reverse the logic.. :hehe:

  • Thanks for an unusual (and interesting) question, Ron!

  • +1

    Just because I have SQL 2012 installed on my machine.

    Otherwise it would be a lottery.

    What about the months, 4 winter, 2 spring?

  • Of course it technically errors out because of the period at the end of Season in the Select COUNT(Season) query



    --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]

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

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