Advertisement
mauza

Untitled

Mar 20th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. /*
  2. Question #2 - 10 points
  3.  
  4. Write a query to return sales totals for each sales territory for the year
  5. or 2013.
  6.  
  7. Return two columns - the Sales Territory name and the total sales. Total
  8. sales is calculated by multiplying the unit price by quantity, then adding
  9. in the tax amount for each line of the invoice. Sort the list from largest
  10. to smallest total sales.
  11.  
  12. Sales Territory can be found on the StateProvince table. Use the DeliveryCityID
  13. on the Customer table to join into Cities.
  14.  
  15. You will get 9 rows. The first row should be "Southeast" with a total sales of 11,946,896.04
  16.  
  17.  
  18. */
  19.  
  20. /*
  21. Question #3 - 10 points
  22.  
  23. Utilizing much of the query from Question #2, provide a sales total for
  24. each state in the United States (countryID = 230). If a state doesn't
  25. have any sales, make sure zero (0) appears.
  26.  
  27. If done correctly, you will get 53 records. The last four records will have
  28. zero values and will include Rhode Island and Delaware. Texas will be
  29. your first record with a total of 3,842,886.52.
  30.  
  31. Two hints - you have to pay attention to the logical processing order of the
  32. query. Also remember that you can have filter criteria included in the
  33. join between two tables (TableA a LEFT JOIN TableB b ON a.id = b.id and A.value > 100)
  34.  
  35. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement