Back-To-School 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. product_name
  2. category_name
  3. diet_type:
    • 'Non-vegetarian' for products from the categories 'Meat/Poultry' and 'Seafood'.
    • '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 ('Germany', 'Switzerland', 'Austria') THEN 'German'
  WHEN country IN ('UK', 'Canada', 'USA', 'Ireland') THEN 'English'
  ELSE 'Other'
END AS language