sql query logics

  • hi friends i have a small doubt in sql plz tell me how to solve this task

    we have following two tables

    CUSTOMERMASTER

    CustomerID int,

    Name varchar(50),

    Address varchar(50),

    Telephone int,

    Email varchar(50)

    SALESORDERMASTER

    SalesOrderID int ,

    SalesOrderDate date ,

    CustomerID int,

    ProductID int,

    Quantity int

    1. Write a query to return the Customer details and the details of the most recent order placed by the customer.

    The result should also include the details of all the customers who have not placed any orders at all.

    2. If this was the only query to be executed at all times, what indexes would you create on the two tables?

  • Interview? Homework? What have you done so far?

    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
  • how can u gues it is interview question? and in case of its interview question why ur not help?ok if u know answer tell me answers its help other wise donot comments unnecessary

  • What have you done so far, where are you stuck?

    For homework and interviews we're happy to guide people, but not to give out answers. You learn nothing if we do that.

    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
  • asranantha (8/16/2012)


    hi friends i have a small doubt in sql plz tell me how to solve this task

    Hi

    You've posted four or five similar questions and as Gail has already pointed out, they are either homework or interview questions.

    If they are for an interview then you should know the answers already - if you do not, then you are unqualified for the position. Cheating you way into a role for which you are not qualified could harm both you and the company.

    If it's homework, then you should know the answers after completing the assignment - and not by someone else doing your homework for you. Folks here are always willing to help you learn and will take you an extra mile with your assignment if you are prepared to put in some effort.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • asranantha (8/16/2012)


    how can u gues it is interview question? and in case of its interview question why ur not help?ok if u know answer tell me answers its help other wise donot comments unnecessary

    How can we guess....hmmm, well for a start the grammar, punctuation and spelling above differs somewhat from the questions asked below

    1. Write a query to return the Customer details and the details of the most recent order placed by the customer.

    The result should also include the details of all the customers who have not placed any orders at all.

    2. If this was the only query to be executed at all times, what indexes would you create on the two tables?

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

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

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