Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Custom classifications of business objects
Custom grouping of business objects
8. Custom grouping – exercise
Custom counting of business objects
Summary

Instruction

Good. Let's do one more exercise of this kind.

Exercise

We want to create a simple report that will show the number of young and old employees at Northwind. Show two columns: age and employee_count.

The age column has the following values:

  • 'young' for people born after Jan. 1, 1980.
  • 'old' for all other employees.

Stuck? Here's a hint!

Use the following condition:

birth_date > '1980-01-01'

Here's an example of using CASE WHEN:

CASE
  WHEN country IN ('USA', 'Canada') THEN 'North America'
  WHEN country IN ('Japan', 'Singapore') THEN 'Asia'
  ELSE 'Other'
END AS supplier_continent