Summer 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 
  OrderID,
  CustomerID,
  ShipCountry,
  CASE
    WHEN ShipCountry = N'USA' OR ShipCountry = N'Canada' THEN 0.0
  END AS ShippingCost
FROM Orders
WHERE OrderID 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 ShipCountry value? Let's find out.

Exercise

Run the template query, and compare the values in the ShipCountry and ShippingCost columns.

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