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