Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Method One
Method Two
Method Three
9. Method 3 – exercise
Summary

Instruction

Good job! Let's do one more exercise of this kind.

Exercise

For each employee, show the percentage of total revenue (before discount) generated by orders shipped to the USA and to Germany. Show the following columns:

  1. EmployeeID
  2. FirstName
  3. LastName
  4. RevPercentageUSA
  5. RevPercentageGermany

Round the percentages to two decimal places.

Stuck? Here's a hint!

Write two CTEs, USARevenue and GermanyRevenue. You can find the total revenue (before discount) generated by orders shipped to the USA with the following code:

SUM(CASE
  WHEN ShipCountry = N'USA'
    THEN UnitPrice * Quantity
  ELSE 0
END)