Understanding the question at hand (word problems!)

  • As I read through the training books for SQL, and the forums for that matter I have a hard time visualizing exactly what the question is asking.

    Something like:

    "Return for each order the custid, orderid, and value using a window function, also returning a grand total, and customer total, from sales.orders"

    Hoping I could gain some help for the accomplished ninjas in the forums as to how they approach question like this (and more advanced questions).

    As I work through problem in TSQL I usually like to start with a vague glimpse as to what I'm trying to create (visualizing to a certain extent). So, with the query above, I might just run

    SELECT custid, orderid, val FROM sales.orders

    then knowing that I need to produce a running total I know that I need to add something to the select statement... and build so on.

    Anyways, any help is appreciated!

  • I can't speak for anyone else but I don't tolerate poorly written word problems in real life. If I have to guess as to their meaning, then I could be going down the wrong path of development. That, of course, costs a lot of time and money and could certainly cause a schedule to be missed. I ask for the same type of thing that I ask for on these forums... correctly identify the inputs, what the result should be, clarify how you got from the inputs to the results, and provide any "trick/esoteric" formulas instead of having me reinvent the wheel. Of course, that's a whole lot different than telling me how to write code to do the things being asked. If you're going to tell me how to write the code, you should probably write it yourself and submit it to me for safety, functionality, readability, and performance review.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I've just spent part of the morning (teaching database design today) explaining why a business requirements document needs to be specific and detailed (and telling horror stories of times I've seen vague ones)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (2/12/2014)


    I've just spent part of the morning (teaching database design today) explaining why a business requirements document needs to be specific and detailed (and telling horror stories of times I've seen vague ones)

    Agree totally with Jeff and Gail

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Personally, if it's on the forums, I skip it. If I can't understand what's being asked, even to guess at it, I'm not about to go through the pain of six different answers until I finally understand what the original person is asking for. If it's as part of a design or working with a developer and it's confusing... nothing for it but to go through the hard work of "Do you mean this?" over and over again until we arrive at a common understanding. There's nothing else for it, but careful clear communication.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thank you for replies everyone, glad that I'm not going crazy

Viewing 6 posts - 1 through 5 (of 5 total)

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