Instruction
It's time to wrap things up! Let's review the concepts we've covered in this part:
- We can calculate multiple metrics for a given business object using multiple aggregate functions in a single query.
- We can use
COUNT(CASE WHEN ...)multiple times in a single query to count objects in multiple groups. - When calculating percentages, remember to cast one of the counts to the
decimaltype. You can also use theROUND()function, like this:ROUND(count_shipped / count_all::decimal * 100, 2) AS shipped_ratio
All right, how about a quiz before we move on?
Exercise
Click to continue.



