TSQL Challenge 36 - Create a graph/Chart with TSQL

  • Comments posted to this topic are about the item TSQL Challenge 36 - Create a graph/Chart with TSQL

  • The data in the challenge is obviously unrealistic in order to be able to produce the graph. I use graphing in SQL Server for on a regular basis, as illustrated below. All are bar charts, but they are laid sideways to conform to rows of data.

    [font="Courier New"]*** Orders By Source ***

    CreateDate Chart

    ----------- --------------------------------------------------

    2010-08-03 AAAAAAAAAAAAAAAASSSSSSSSSSSSSSSCCCWWWW

    2010-08-04 AAAAAAAAAAAAAAAASSSSSSSSSSSSSSCCWWW

    2010-08-05 AAAAAAAAAAAAAASSSSSSSSSSSCWW

    2010-08-06 AAAAAAAAAAAAAAAAAAAAAAAAAASSSSSSSSSSSCCW

    2010-08-07 aSSSSSSSSSSSW

    2010-08-08 AAAAAAAAAAAASSSSSSSSW

    2010-08-09 AAAAAAAAAAAASSSSSSSSw

    *** Order Pace ***

    Month Chart....!....!....!....|....!....!....!....!....!

    -------- --------------------------------------------------

    156 ••••••••••••————————————————————————————

    157 •••••••••••••——————————————————————————————

    158 •••••••••••••———————————————————————————————

    159 •••••••••••••—————————————————————————————————————

    160 •••••••••••••—————————————————————————————

    161 •••••••••••••——————————————————————————

    162 •••••••••••

    *** Warehouse Shipments ***

    ShipDate Chart....!....!....!....|....!....!....!....!....!

    ----------- --------------------------------------------------

    2010-07-19 •••••••••••••••••••••••••••••••••

    2010-07-20 ••••••••••••••••••••

    2010-07-21 •••••••••••••••••••

    2010-07-22 ••••••••••••••••••••••••••••••••

    2010-07-23 •••••••••••••••••••[/font]

  • Please post it on the T-SQL Challenges site.

  • Jonathan,

    If you can easily solve the challenge posted, then you might want to submit some challening problems at this site. I can guarantee you that you will be surprised with the solutions that some of the participants come up with. They will leave you speachless!

    Sometimes the challenges don't come from the real world. They are created and made up and adapted to be challenging.

  • I guess this is as good a place as any to bitch a little about that site (and I've done it there several times as well).

    The "charter" of the site is to promote "Set Based Programming" which I absolutely agree with. However, most of the problems given require a "SINGLE QUERY" and I just have to say it out loud again that SET BASED <> SINGLE QUERY. In fact, I can show you some "single query" code that's no where near being set based even though it IS a single query and it has no hint of a loop or recurrsion in it.

    Doing things in a single query is NOT the correct message to be sending out especially to folks who may be new at the craft. I much prefer Phil Factor's Speed Phreak Challenges because they actually allow Developers to think about the best solution instead being forced into artificial requirement of trying to do things in a single query. I'll also tell you that there are many single query solutions on that site that can be beaten for performance quite badly if they were to allow multi-query solutions.

    Rant complete (for the minute)...

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

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

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