Back-To-School Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Custom classifications of business objects
4. Non-matching objects
Custom grouping of business objects
Custom counting of business objects
Summary

Instruction

Perfect! Our store is now introducing a new shipping cost policy: Any package shipped to the US or Canada is free! Now we want to create a report that shows the updated shipping cost for selected orders. Here's a query that will do the job:

SELECT 
  order_id,
  customer_id,
  ship_country,
  CASE
    WHEN ship_country = 'USA' OR ship_country = 'Canada' THEN 0.0
  END AS shipping_cost
FROM orders
WHERE order_id BETWEEN 10720 AND 10730;

You may have noticed that we only defined a column value for the US and Canada. What will happen if there's another ship_country value? Let's find out.

Exercise

Run the template query, and compare the values in the ship_country and shipping_cost columns.

For countries other than the US and Canada, the shipping_cost value is NULL.