Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Custom classifications of business objects
6. Fallback values – exercise
Custom grouping of business objects
Custom counting of business objects
Summary

Instruction

You did well! Let's do one more exercise of this kind.

Exercise

Let's create a report that will divide all products into vegetarian and non-vegetarian categories. For each product, show the following columns:

  1. ProductName
  2. CategoryName
  3. DietType:
    • N'Non-vegetarian' for products from the categories N'Meat/Poultry' and N'Seafood'.
    • N'Vegetarian' for any other category.

Stuck? Here's a hint!

You will need to join the Categories and Products tables.

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

CASE
  WHEN Country IN (N'Germany', N'Switzerland', N'Austria') THEN N'German'
  WHEN Country IN (N'UK', N'Canada', N'USA', N'Ireland') THEN N'English'
  ELSE N'Other'
END AS Language