Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
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 (shown as count_1),
  3. count of all giftcards ever purchased (shown as count_2),
  4. show the percentage that the respective giftcard type constitutes in relation to all gift cards. Show the last column rounded to integer values and name it percentage.

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).