View the step-by-step solution to:

Question

Step 7: make and Analyze Query for Year-to-Date Sales by SalesPerson


Management has asked for a

list of total year-to-date sales by each salesperson, with the salesperson having the highest dollar sales at the top. Each salesperson should be identified by his or her business entity ID, first name, and last name. You will make query to display this summary and analyze the results.

a.     In the Object Explorer pane, scroll down in the list of tables under the AdventureWorks database until you see the Sales.SalesPerson table. Expand Sales.SalesPerson, and then under that, expand the Columns folder to see the list of columns in this table. You will refer to this list in composing your query.

b.     You may also need to refer to the column list for the Person.Person table to get the first and last names.

c.      Highlight and delete the code for your previous query, OR press Ctrl + N or click the New Query button to open a new query tab. Ensure that the AdventureWorks2008R2 database is still selected in the drop-down list at the upper left of the window.

d.     Referring to the list of columns, enter the SQL code for the desired query in the New Query pane on the right. Your query should display the BusinessEntityID, salesperson FirstName and LastName (from the Person.Person table), and SalesYTD, grouped by BusinessEntityID, FirstName, and LastName, and sorted so that the highest SalesYTD appears at the top. Refer to the query in the previous step for an example of the SQL code for a similar query.

e.     Click the ! Execute button on the toolbar to execute this query. Results will be displayed at the bottom of the Query window.

f.       Capture a screenshot showing both your SQL code in the upper pane and the query results in the lower pane. (On a Windows computer, to capture a screenshot of the active window, press Alt + PrintScreen, or use the Windows Snipping Tool.)

g.     In your Word document, enter the heading "Year-to-Date Sales by Salesperson." Paste your query screenshot into your Microsoft Word document below this heading.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 MYSQL tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors