Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Multiple metrics for a single object
3. Multiple metrics for a single object – exercise
Metrics for two groups
Ratios and percentages
Global vs. specific metrics


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


For each employee, determine their performance for 2016: Compute the total number and the total revenue for orders processed by each employee. Show the employee's first name (first_name), last name (last_name), and the two metrics in columns named order_count (total number of orders processed by the employee) and order_revenue (total revenue for orders processed by the employee).

Stuck? Here's a hint!

You need to join three tables. Remember to use DISTINCT when counting the number of orders. Group by not only first_name and last_name but also by employee_id – only the ID is unique (it may happen that two different employees have the same first and last name).

The order_revenue column should be counted as SUM(unit_price * quantity * (1 - discount)).