Order Value per Region

  • Please assist. I would like to answer this question: "What is the average order value in the African Region per month?"

    My Data Model:

    sample-data-tpch-schema

     

    My Code:

     

    SELECT Avg(Orders)  AS Order Value

    FROM Orders, Customer, Nation, Region

    Join Customer AS C

    ON Customer.Custkey = Orders.Custkey

    Join Customer AS C ON Customer.Nationkey=Nation.Nationkey

    Join Nation.Nationkey=Region.Nationkey

     

    where Region = Africa

     

    AND Region = Africa

  • Hmmmm, the first question would be "Why is someone with 3000+ points on this forum asking such a simple question?"

    😎

    The second question is "do you understand the problem, the algorithm applicable and the variables that must be applied?"

    Just a hint, I don't do other people's school work!

  • If you want a coded solution, please provide DDL, INSERT statements, desired results etc. You know the drill.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Post withdrawn.

    --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 4 posts - 1 through 3 (of 3 total)

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