Introduction
Simple OVER()
PARTITION BY
13. PARTITION BY – Exercise 3
Ranking functions
Window frame
Analytic functions
ORDER BY PARTITION BY
Order of evaluation
Summary

Instruction

Good job! Let's now do some mathematic!

Exercise

Show:

  1. distinctive amount_worth values of giftcards,
  2. count of the number of giftcards with this value that were ever purchased,
  3. count of all giftcards ever purchased,
  4. show the percentage that the respective giftcard type constitutes in relation to all gift cards. Show the last column rounded to integer values.

Stuck? Here's a hint!

The last column is the most tricky one. Use ROUND(...). Inside, apply division. To avoid integer division, use CAST(column AS numeric).

Console

Code editor

Result

TableConsole