On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Custom classifications of business objects
Custom grouping of business objects
Custom counting of business objects
13. CASE WHEN with SUM – exercise


Good job! Let's write one more query with SUM(), this time from scratch!


There have been a lot of orders shipped to France. Of these, how many order items were sold at full price and how many were discounted? Show two columns with the respective counts: full_price and discounted_price.

Stuck? Here's a hint!

Use the discount column from the order_items table.

Here's an example of using SUM() (from the previous exercise):

    WHEN region = 'WA' THEN 1
  END) AS orders_wa_employees,
    WHEN region != 'WA' THEN 1
  END) AS orders_not_wa_employees
FROM employees e
JOIN orders o
  ON e.employee_id = o.employee_id;